Sha256: c3e3350d1e53bd2eb9bd63a261048f4ee93c4e4621ec407a56ac7fc8850166f3
Contents?: true
Size: 652 Bytes
Versions: 22
Compression:
Stored size: 652 Bytes
Contents
require 'facets/core/binding/eval' require 'facets/core/binding/op_store' class Binding # Returns the value of some variable. # # a = 2 # binding["a"] #=> 2 # def []( x ) eval( x.to_s ) 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_op_fetch assert_equal( "hello", @bind["x"] ) end end =end
Version data entries
22 entries across 22 versions & 1 rubygems