method
local_variable_get
v2_2_9 -
Show latest stable
- Class:
Binding
local_variable_get(p1)public
Returns the value of the local variable symbol.
def foo a = 1 binding.local_variable_get(:a) #=> 1 binding.local_variable_get(:b) #=> NameError end
This method is the short version of the following code:
binding.eval("#{symbol}")