Class: Binding
Instance Method Summary collapse
-
#locals ⇒ Object
returns a hash of localvar/localvar-values from binding, useful for template engines that do not accept bindings and force passing locals via hash usage: x = 42; p binding.locals #=> 42.
Instance Method Details
#locals ⇒ Object
returns a hash of localvar/localvar-values from binding, useful for template engines that do not accept bindings and force passing locals via hash
usage: x = 42; p binding.locals #=> {'x'=> 42}
7 8 9 10 11 |
# File 'lib/ramaze/snippets/binding/locals.rb', line 7 def locals Kernel::eval ' local_variables.inject({}){|h,v| h.update v => eval(v)} ', self end |