Class: Koltira::Context
- Inherits:
-
Object
- Object
- Koltira::Context
- Defined in:
- lib/koltira/context.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #dup ⇒ Object
-
#initialize(data = {}) ⇒ Context
constructor
A new instance of Context.
- #reset! ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Context
Returns a new instance of Context.
7 8 9 |
# File 'lib/koltira/context.rb', line 7 def initialize(data = {}) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/koltira/context.rb', line 5 def data @data end |
Instance Method Details
#[](key) ⇒ Object
11 12 13 |
# File 'lib/koltira/context.rb', line 11 def [](key) @data[key] end |
#[]=(key, value) ⇒ Object
15 16 17 |
# File 'lib/koltira/context.rb', line 15 def []=(key, value) @data[key] = value end |
#dup ⇒ Object
23 24 25 |
# File 'lib/koltira/context.rb', line 23 def dup new(@data.dup) end |
#reset! ⇒ Object
19 20 21 |
# File 'lib/koltira/context.rb', line 19 def reset! @data = {} end |