method
local_variable_defined?
v2_4_6 -
Show latest stable
- Class:
Binding
local_variable_defined?(p1)public
Returns true if a local variable symbol exists.
def foo a = 1 binding.local_variable_defined?(:a) #=> true binding.local_variable_defined?(:b) #=> false end
This method is the short version of the following code:
binding.eval("defined?(#{symbol}) == 'local-variable'")