Sha256: 048d97f6a4af11d5c3e77d6edf1ea42e88032b861bac0b9949d0ee802886b3e2
Contents?: true
Size: 608 Bytes
Versions: 22
Compression:
Stored size: 608 Bytes
Contents
require 'facets/core/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
22 entries across 22 versions & 1 rubygems