Support Ruby 1.9+ (specifically 2.X)

Fixing an issue with string.each not being defined in ruby 1.9+.  Changing to use string.each_line per the ruby documentation: http://ruby-doc.org/core-1.9.3/String.html