Class: Onuro::Context
- Inherits:
-
Object
- Object
- Onuro::Context
- Defined in:
- lib/onuro/context.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #add(key, value) ⇒ Object
-
#initialize(**options) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(**options) ⇒ Context
Returns a new instance of Context.
15 16 17 18 |
# File 'lib/onuro/context.rb', line 15 def initialize(**) @data = Hash.new(0) @data.merge!() end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/onuro/context.rb', line 5 def data @data end |
Instance Method Details
#[](key) ⇒ Object
7 8 9 |
# File 'lib/onuro/context.rb', line 7 def [](key) data[key] end |
#[]=(key, value) ⇒ Object
11 12 13 |
# File 'lib/onuro/context.rb', line 11 def []=(key, value) data[key] = value end |
#add(key, value) ⇒ Object
20 21 22 |
# File 'lib/onuro/context.rb', line 20 def add(key, value) data[key] = value end |