From: Kurt Stephens Date: 2010-03-27T03:45:44+09:00 Subject: [ruby-core:29047] [Feature #889] erb.rb should use Array and << for eoutvar and not String and concat Issue #889 has been updated by Kurt Stephens. This is not a good idea, because the expression value Strings accumulated in the Array must be protected from mutation. ERB expressions can have side-effects.
SOME_STRING = 'foobar'
def foo
  SOME_STRING
end
def bar
  SOME_STRING.sub!(/bar/, '')
  SOME_STRING
end
# ERB GENERATED CODE: from "<%= foo %><%= bar %>"
eoutvar = [ ]
eoutvar << foo
eoutvar << bar
eoutvar.join('')
---------------------------------------- http://redmine.ruby-lang.org/issues/show/889 ---------------------------------------- http://redmine.ruby-lang.org