String#each
String#eachメソッドは、普通は行単位で区切ります。
s = <<"EOD" This is the 1st line. This is the 2nd line. This is the 3rd line. EOD s.each { |line| p line }
実行結果です。
"This is the 1st line.\n" "This is the 2nd line.\n" "This is the 3rd line.\n"
String#eachメソッドは、普通は行単位で区切ります。
s = <<"EOD" This is the 1st line. This is the 2nd line. This is the 3rd line. EOD s.each { |line| p line }
実行結果です。
"This is the 1st line.\n" "This is the 2nd line.\n" "This is the 3rd line.\n"