Sha256: 3f9ac0da5e03b4c1caf671f5aacfdd4d706e46836889600b784167fa313eccd9

Contents?: true

Size: 697 Bytes

Versions: 22

Compression:

Stored size: 697 Bytes

Contents

require 'facets/core/binding/eval'

class Binding

  # Returns the local variables defined in the binding context
  #
  #   a = 2
  #   binding.local_variables  #=> ["a"]
  #
  def local_variables()
    eval( "local_variables" )
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCBinding < Test::Unit::TestCase

    def setup
      a = 1
      b = 2
      x = "hello"
      # the line number must be updated if it moves
      @bind = binding; @this_line_no = 25
    end

    def test_local_variables
      assert_equal( ["a","b","x"], @bind.local_variables )
    end

  end

=end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
facets-1.3.0 lib/facets/core/binding/local_variables.rb
facets-1.2.0 lib/facets/core/binding/local_variables.rb
facets-1.2.1 lib/facets/core/binding/local_variables.rb
facets-1.3.1 lib/facets/core/binding/local_variables.rb
facets-1.3.3 lib/facets/core/binding/local_variables.rb
facets-1.3.2 lib/facets/core/binding/local_variables.rb
facets-1.4.1 lib/facets/core/binding/local_variables.rb
facets-1.4.2 lib/facets/core/binding/local_variables.rb
facets-1.4.0 lib/facets/core/binding/local_variables.rb
facets-1.4.3 lib/facets/core/binding/local_variables.rb
facets-1.4.4 lib/facets/core/binding/local_variables.rb
facets-1.4.5 lib/facets/core/binding/local_variables.rb
facets-1.7.38 lib/facets/core/binding/local_variables.rb
facets-1.7.0 lib/facets/core/binding/local_variables.rb
facets-1.7.30 lib/facets/core/binding/local_variables.rb
facets-1.7.46 lib/facets/core/binding/local_variables.rb
facets-1.8.51 lib/facets/core/binding/local_variables.rb
facets-1.8.0 lib/facets/core/binding/local_variables.rb
facets-1.8.20 lib/facets/core/binding/local_variables.rb
facets-1.8.49 lib/facets/core/binding/local_variables.rb