How do you loop through a multiline string in Ruby? March 31, 2023 by Tarik String#each_line str.each_line do |line| #do something with line end