I read about Dave Thomas Ruby one liners
Its says
# print section of file between two regular expressions, /foo/ and /bar/
$ ruby -ne '@found=true if $_ =~ /foo/; next unless @found; puts $_; exit if $_ =~ /bar/' < file.txt
May I know how i can use this is my Ruby code and not from command line?