Class: Nasty::Key
Instance Method Summary collapse
- #add_to(store, value) ⇒ Object
- #contained_in?(store) ⇒ Boolean
-
#initialize(key) ⇒ Key
constructor
A new instance of Key.
- #item_from(store) ⇒ Object
- #remove_from(store) ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(key) ⇒ Key
Returns a new instance of Key.
3 4 5 |
# File 'lib/nasty/key.rb', line 3 def initialize(key) @key = key end |
Instance Method Details
#add_to(store, value) ⇒ Object
7 8 9 |
# File 'lib/nasty/key.rb', line 7 def add_to(store, value) store[to_sym] = value end |
#contained_in?(store) ⇒ Boolean
15 16 17 |
# File 'lib/nasty/key.rb', line 15 def contained_in?(store) item_from(store) end |
#item_from(store) ⇒ Object
19 20 21 |
# File 'lib/nasty/key.rb', line 19 def item_from(store) store[to_sym] end |
#remove_from(store) ⇒ Object
11 12 13 |
# File 'lib/nasty/key.rb', line 11 def remove_from(store) store[to_sym] = nil end |
#to_sym ⇒ Object
23 24 25 |
# File 'lib/nasty/key.rb', line 23 def to_sym @key.to_sym end |