Class: Predicator::Context
- Inherits:
-
Object
- Object
- Predicator::Context
- Defined in:
- lib/predicator/context.rb
Instance Method Summary collapse
- #bind(name, value) ⇒ Object (also: #[]=)
- #binding_for(name) ⇒ Object (also: #[])
-
#initialize(params = {}) ⇒ Context
constructor
A new instance of Context.
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 |