Class: JSH::Pair
- Inherits:
-
Object
- Object
- JSH::Pair
- Defined in:
- lib/jsh/pair.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #all ⇒ Object
-
#initialize(data = nil) ⇒ Pair
constructor
A new instance of Pair.
Constructor Details
#initialize(data = nil) ⇒ Pair
Returns a new instance of Pair.
5 6 7 |
# File 'lib/jsh/pair.rb', line 5 def initialize(data = nil) @data = data || default_data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/jsh/pair.rb', line 3 def data @data end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 |
# File 'lib/jsh/pair.rb', line 9 def [](key) @data[key] end |
#[]=(key, value) ⇒ Object
13 14 15 |
# File 'lib/jsh/pair.rb', line 13 def []=(key, value) @data[key] = value end |
#all ⇒ Object
17 18 19 |
# File 'lib/jsh/pair.rb', line 17 def all @data end |