Try something like this:
def meth2( item1, item2 )
item1.upcase + "..." + item2.downcase
end
str2 = meth2 <<EOF1, <<EOF2
some string
EOF1
ANOTHER STRING
EOF2
The problem you are having is due to not fully understanding how heredoc-style string literals work. The <<DELIMITER
part just is telling the parser to get it's string data from the lines that follow it. If there is more than one <<DELIMITER
on a line, then they stack, and are read in in sequence. So, in this case, the code above is exactly equivalent to:
def meth2( item1, item2 )
item1.upcase + "..." + item2.downcase
end
str2 = meth2 " some string\n", " ANOTHER STRING\n"
Most importantly, there is no way to build a heredoc into a function like you were trying to do there... They can only be used in the same places and manner that other String literals, such as "double quoted" or 'single quoted' literals, can be used.