Class: DS::Pair
- Inherits:
-
Object
- Object
- DS::Pair
- Defined in:
- lib/ds/pair.rb
Overview
Simple class for key, value objects
Instance Attribute Summary collapse
-
#key ⇒ Object
(also: #first)
Returns the value of attribute key.
-
#value ⇒ Object
(also: #second)
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(x, y) ⇒ Pair
constructor
A new instance of Pair.
Constructor Details
#initialize(x, y) ⇒ Pair
Returns a new instance of Pair.
9 10 11 12 |
# File 'lib/ds/pair.rb', line 9 def initialize(x, y) @key = x @value = y end |
Instance Attribute Details
#key ⇒ Object Also known as: first
Returns the value of attribute key.
4 5 6 |
# File 'lib/ds/pair.rb', line 4 def key @key end |
#value ⇒ Object Also known as: second
Returns the value of attribute value.
4 5 6 |
# File 'lib/ds/pair.rb', line 4 def value @value end |