Class: Predicator::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/predicator/context.rb

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Context

Returns a new instance of Context.



3
4
5
6
# File 'lib/predicator/context.rb', line 3

def initialize params={}
  @bindings = {}
  params.each{ |key,value| bind key, value }
end

Instance Method Details

#bind(name, value) ⇒ Object Also known as: []=



8
9
10
# File 'lib/predicator/context.rb', line 8

def bind name, value
  @bindings[name.to_s] = value
end

#binding_for(name) ⇒ Object Also known as: []



13
14
15
# File 'lib/predicator/context.rb', line 13

def binding_for name
  @bindings[name.to_s]
end