Sha256: 233cb29fdf5693548326577b438043c03c21bf388944027ea783d025b2567e13

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

require 'nano/binding/eval'

class Binding

  # Returns the nature of something, nil if that thing is not defined.
  def defined?( x )
    eval( "defined? #{x}" )
  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_defined?
      assert( @bind.defined?("a") )
    end

  end

=end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/nano/binding/defined.rb