Class: Nasty::SimpleContext

Inherits:
Object show all
Defined in:
lib/nasty/simple_context.rb

Instance Method Summary collapse

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

Returns:

  • (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