Project

General

Profile

Bug #12031 ยป 0001-Make-ERB-work-with-enable-frozen-string-literal.patch

jeremyevans0 (Jeremy Evans), 01/28/2016 09:39 PM

View differences:

lib/erb.rb
# ERB#src:
#
# compiler = ERB::Compiler.new('<>')
# compiler.pre_cmd = ["_erbout=''"]
# compiler.pre_cmd = ["_erbout=String.new"]
# compiler.put_cmd = "_erbout.concat"
# compiler.insert_cmd = "_erbout.concat"
# compiler.post_cmd = ["_erbout"]
......
# <i>Generates</i>:
#
# #coding:UTF-8
# _erbout=''; _erbout.concat "Got "; _erbout.concat(( obj ).to_s); _erbout.concat "!\n"; _erbout
# _erbout=String.new; _erbout.concat "Got "; _erbout.concat(( obj ).to_s); _erbout.concat "!\n"; _erbout
#
# By default the output is sent to the print method. For example:
#
......
def set_eoutvar(compiler, eoutvar = '_erbout')
compiler.put_cmd = "#{eoutvar}.concat"
compiler.insert_cmd = "#{eoutvar}.concat"
compiler.pre_cmd = ["#{eoutvar} = ''"]
compiler.pre_cmd = ["#{eoutvar} = String.new"]
compiler.post_cmd = ["#{eoutvar}.force_encoding(__ENCODING__)"]
end
    (1-1/1)