В качестве альтернативного примера, показывающего, как работают HEREDOC, на днях в IRB я написал:
require 'nokogiri'
doc = Nokogiri.XML(<<ENDXML,&:noblanks)
...gobs and gobs of pasted xml...
ENDXML
Еще более безумным является этот законный синтаксис для одновременной передачи нескольких строк HEREDOC:
p( <<END1, <<-END2, <<END3 )
This indented text is part of
the first parameter, END1
END1
And this text is part of param2
whose ending sigil may be indented
END2
and finally this text
is part of
the third parameter
END3
#=> " This indented text is part of\n the first parameter, END1\n"
#=> "And this text is part of param2\n whose ending sigil may be indented\n"
#=> "and finally this text\nis part of\nthe third parameter\n"