Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
ERB#set_eoutvar
set_eoutvar(compiler, eoutvar = '_erbout') → [eoutvar]
lib/erb.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/erb.rb, line 1024
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:
Example
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>
Example
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>