Check out example codes for "ruby read stdin". It will help you in understanding the concepts better.
Code Example 1
# print all the lines in every file passed via command line that contains login ARGF.each do |line| puts line if line =~ /login/ end
Learn ReactJs, React Native from akashmittal.com