I am trying to use a custom method with here-doc and want to pass parameter (there is no business case, I am merely trying to learn ruby). Is there a way to pass parameter in this case? This is what I have so far.
Simple method, just works fine.
def meth1
self.upcase
end
str1 = <<MY.meth1
i am a small case string
MY
# "I AM A SMALL CASE STRING\n"
Now, I thought let us drop some parameters and tried different variations and irb gives me a blank stare.
#variation 1
def meth2( <<EOF1, <<EOF2 )
EOF1.upcase + "..." + EOF2.downcase
end
str2 = <<MY.meth2
some string
EOF1
ANOTHER STRING
EOF2
MY