Methods

Class/Module Index [+]

Quicksearch

Ramaze::CoreExtensions::Binding

Extensions for Binding

Public Instance Methods

locals() click to toggle source

Returns a hash of localvar/localvar-values from binding, useful for template engines that do not accept bindings and force passing locals via hash

@example

x = 42; p binding.locals #=> {'x'=> 42}
# File lib/ramaze/snippets/binding/locals.rb, line 11
def locals
  ::Kernel::eval '
  local_variables.inject({}){|h,v|
    k = v.to_s
    h.merge!(k => eval(k))
  }', self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.