instance method
ERB#set_eoutvar
set_eoutvar(compiler, eoutvar = '_erbout') → [eoutvar]
lib/erb.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/erb.rb, line 971
def set_eoutvar(compiler, eoutvar = '_erbout')
compiler.put_cmd = "#{eoutvar}.<<"
compiler.insert_cmd = "#{eoutvar}.<<"
compiler.pre_cmd = ["#{eoutvar} = +''"]
compiler.post_cmd = [eoutvar]
end
Sets the eoutvar value in the ERB::Compiler object compiler; returns a 1-element array containing the value of eoutvar:
template = ERB.new('')
compiler = template.make_compiler(nil)
pp compiler
#<ERB::Compiler:0x000001cff8a9aa00
@insert_cmd="print",
@percent=false,
@post_cmd=[],
@pre_cmd=[],
@put_cmd="print",
@trim_mode=nil>
template.set_eoutvar(compiler, '_foo') # => ["_foo"]
pp compiler
#<ERB::Compiler:0x000001cff8a9aa00
@insert_cmd="_foo.<<",
@percent=false,
@post_cmd=["_foo"],
@pre_cmd=["_foo = +''"],
@put_cmd="_foo.<<",
@trim_mode=nil>