require 'rubygems'
require 'activesupport'
# this doesn't work as expected. does anyone know why?
z = returning html="" do
html += "stuff"
html += "more stuff" if true
end
p z
#>> ""
# this works though
z = returning html=[] do
html << "stuff"
html << "more_stuff" if true
end.join("\n")
p z
#>> "stuff\nmore_stuff"
Update: Thanks DrMark, I should have done it like this:
(I didn’t realize that one could use << on strings)
z = returning html="" do
html << "stuff"
html << " more stuff" if true
end

