iterate over string with each_line