Class: Nasty::SimpleContext
Instance Method Summary collapse
- #add(key, value) ⇒ Object
- #contains?(key) ⇒ Boolean
-
#initialize(store = {}) ⇒ SimpleContext
constructor
A new instance of SimpleContext.
- #item_for(key) ⇒ Object
- #remove(key) ⇒ Object
Constructor Details
#initialize(store = {}) ⇒ SimpleContext
Returns a new instance of SimpleContext.
3 4 5 |
# File 'lib/nasty/simple_context.rb', line 3 def initialize(store = {}) @store = store end |
Instance Method Details
#add(key, value) ⇒ Object
7 8 9 |
# File 'lib/nasty/simple_context.rb', line 7 def add(key, value) key.add_to(@store, value) end |
#contains?(key) ⇒ Boolean
15 16 17 |
# File 'lib/nasty/simple_context.rb', line 15 def contains?(key) key.contained_in?(@store) end |
#item_for(key) ⇒ Object
19 20 21 |
# File 'lib/nasty/simple_context.rb', line 19 def item_for(key) key.item_from(@store) end |
#remove(key) ⇒ Object
11 12 13 |
# File 'lib/nasty/simple_context.rb', line 11 def remove(key) key.remove_from(@store) end |