Return a binding : binding « Method « Ruby






Return a binding


def aMethod
  a = "local variable"
  return binding
end

the_binding = aMethod
eval "a", the_binding   # "local variable"

 








Related examples in the same category

1.Bind a block to a method