End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
ERB#new_toplevel
new_toplevel(vars = nil)
lib/erb.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/erb.rb, line 921
def new_toplevel(vars = nil)
b = TOPLEVEL_BINDING
if vars
vars = vars.select {|v| b.local_variable_defined?(v)}
unless vars.empty?
return b.eval("tap {|;#{vars.join(',')}| break binding}")
end
end
b.dup
end
Returns a new binding each time near TOPLEVEL_BINDING for runs that do not specify a binding.
See also
#make_compiler
#result
#location=
#result_with_hash
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0