Sha256: 5085fb6f70adaa164557ffa97162dd6cfb061eef91c356b2e986b0b00f840273

Contents?: true

Size: 332 Bytes

Versions: 23

Compression:

Stored size: 332 Bytes

Contents

require 'facets/binding/eval'

class Binding

  # Returns the value of some variable.
  #
  #   a = 2
  #   binding["a"]  #=> 2
  #
  def []( x )
    eval( x.to_s )
  end

  # Set the value of a local variable.
  #
  #   binding["a"] = 4
  #   a  #=> 4
  #
  def []=( l, v )
    eval( "lambda {|v| #{l} = v}").call( v )
  end

end

Version data entries

23 entries across 22 versions & 3 rubygems

Version Path
ragtag-0.6.1 lib/ragtag/core_ext/opvars.rb
facets-2.9.2 src/core/facets/binding/op.rb
facets-2.9.2 lib/core/facets/binding/op.rb
facets-2.9.1 lib/core/facets/binding/op.rb
ragtag-0.6.0 lib/ragtag/core_ext/opvars.rb
facets-2.9.0 lib/core/facets/binding/op.rb
facets-2.9.0.pre.2 lib/core/facets/binding/op.rb
facets-2.9.0.pre.1 lib/core/facets/binding/op.rb
facets-2.8.4 lib/core/facets/binding/opvars.rb
facets-2.8.3 lib/core/facets/binding/opvars.rb
facets-2.8.2 lib/core/facets/binding/opvars.rb
facets-2.8.1 lib/core/facets/binding/opvars.rb
facets-2.8.0 lib/core/facets/binding/opvars.rb
facets-2.7.0 lib/core/facets/binding/opvars.rb
facets-2.6.0 lib/core/facets/binding/opvars.rb
facets-2.4.2 lib/core/facets/binding/opvars.rb
facets-2.4.4 lib/more/facets/binding/opvars.rb
facets-2.4.3 lib/more/facets/binding/opvars.rb
facets-2.5.0 lib/more/facets/binding/opvars.rb
facets-2.5.1 lib/more/facets/binding/opvars.rb