Class: Mentawai::Core::AppContext
- Inherits:
-
Object
- Object
- Mentawai::Core::AppContext
- Defined in:
- lib/mentawai/core/app_context.rb
Instance Method Summary collapse
- #get(key) ⇒ Object (also: #[])
- #hasKey?(key) ⇒ Boolean (also: #has_key?, #key?)
-
#initialize ⇒ AppContext
constructor
A new instance of AppContext.
- #keys ⇒ Object
- #put(key, value) ⇒ Object (also: #[]=)
- #remove(key) ⇒ Object
- #values ⇒ Object (also: #each)
Constructor Details
#initialize ⇒ AppContext
Returns a new instance of AppContext.
6 7 8 |
# File 'lib/mentawai/core/app_context.rb', line 6 def initialize @values = Hash.new end |
Instance Method Details
#get(key) ⇒ Object Also known as: []
14 15 16 |
# File 'lib/mentawai/core/app_context.rb', line 14 def get(key) @values[key] end |
#hasKey?(key) ⇒ Boolean Also known as: has_key?, key?
22 23 24 |
# File 'lib/mentawai/core/app_context.rb', line 22 def hasKey?(key) @values.has_key?(key) end |
#keys ⇒ Object
29 30 31 32 33 |
# File 'lib/mentawai/core/app_context.rb', line 29 def keys @values.each do |k| yield k end end |
#put(key, value) ⇒ Object Also known as: []=
10 11 12 |
# File 'lib/mentawai/core/app_context.rb', line 10 def put(key, value) @values[key] = value end |
#remove(key) ⇒ Object
18 19 20 |
# File 'lib/mentawai/core/app_context.rb', line 18 def remove(key) @values.delete(key) end |
#values ⇒ Object Also known as: each
35 36 37 38 39 |
# File 'lib/mentawai/core/app_context.rb', line 35 def values @values.each do |k,v| yield k,v end end |