class Binding

Public Instance Methods

[]( x ) click to toggle source

Returns the value of some variable.

a = 2
binding["a"]  #=> 2
# File lib/ragtag/core_ext/opvars.rb, line 8
def []( x )
  eval( x.to_s )
end
[]=( l, v ) click to toggle source

Set the value of a local variable.

binding["a"] = 4
a  #=> 4
# File lib/ragtag/core_ext/opvars.rb, line 17
def []=( l, v )
  eval( "lambda {|v| #{l} = v}").call( v )
end