Flowdock
method

local_variables

Importance_1
v2_4_6 - Show latest stable - 0 notes - Class: Binding
local_variables() public

Returns the names of the binding’s local variables as symbols.

def foo
  a = 1
  2.times do |n|
    binding.local_variables #=> [:a, :n]
  end
end

This method is the short version of the following code:

binding.eval("local_variables")
Show source
Register or log in to add new notes.