kernel/common/eval.rb
# Names of local variables at point of call (including evaled)
#
Names of local variables at point of call (including evaled)
Names of local variables at point of call ( including evaled )
def local_variables()
    locals = []
    scope = VariableScope.of_sender
    while scope
      if scope.method.local_names
        scope.method.local_names.each {|name|
          name = name.to_s
          locals << name unless name =~ /\A(@{1,2}|\$)/   
        }
      end
      scope.dynamic_locals.keys.each {|name| locals << name.to_s } if scope.dynamic_locals
      scope = scope.parent
    end
    locals
  end
def local_variables ( ) locals = [ ] scope = VariableScope . of_sender while scope if scope . method . local_names scope . method . local_names . each { | name | name = name . to_s locals << name unless name =~ / \A (@{1,2}| \$ ) / } end scope . dynamic_locals . keys . each { | name | locals << name . to_s } if scope . dynamic_locals scope = scope . parent end locals end
Names of local variables at point of call (including evaled)
Names of local variables at point of call ( including evaled )
# Ascend up through all applicable blocks to get all vars. # @todo Weed out "constants"? --rue # Should not have any special cases here