Ruby iterate over lines in a string Mar 13, 2014 str.each_line do |line| #do something with line end Source. [ Ruby Programming ]