class Binding

Public Instance Methods

[](key) click to toggle source

Get a variable in this binding

# File lib/epitools/core_ext/misc.rb, line 18
def [](key)
  eval(key.to_s)
end
[]=(key, val) click to toggle source

Set a variable in this binding

# File lib/epitools/core_ext/misc.rb, line 25
def []=(key, val)
  Thread.current[:_alter_binding_local_] = val
  eval("#{key} = Thread.current[:_alter_binding_local_]")
  Thread.current[:_alter_binding_local_] = nil
end
keys()
Alias for: local_variables
local_variables() click to toggle source
# File lib/epitools/core_ext/misc.rb, line 35
def local_variables
  eval("local_variables").map(&:to_sym)
end
Also aliased as: keys
merge(other) click to toggle source

Combine the variables in two bindings (the latter having precedence)

# File lib/epitools/core_ext/misc.rb, line 49
def merge(other)
  self.eval do
    other.eval do
      binding
    end
  end
end
Also aliased as: |
|(other)
Alias for: merge