Skip to content
instance method

ERB#set_eoutvar

set_eoutvar(compiler, eoutvar = '_erbout') → [eoutvar]

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>
See also #run #result_with_hash also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0