Class: AMA::Entity::Mapper::Type::Aux::HashTuple
- Inherits:
-
Object
- Object
- AMA::Entity::Mapper::Type::Aux::HashTuple
- Defined in:
- lib/ama-entity-mapper/type/aux/hash_tuple.rb
Overview
Simple class to store paired data items
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(key: nil, value: nil) ⇒ HashTuple
constructor
A new instance of HashTuple.
Constructor Details
#initialize(key: nil, value: nil) ⇒ HashTuple
Returns a new instance of HashTuple.
13 14 15 16 |
# File 'lib/ama-entity-mapper/type/aux/hash_tuple.rb', line 13 def initialize(key: nil, value: nil) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
10 11 12 |
# File 'lib/ama-entity-mapper/type/aux/hash_tuple.rb', line 10 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
11 12 13 |
# File 'lib/ama-entity-mapper/type/aux/hash_tuple.rb', line 11 def value @value end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 |
# File 'lib/ama-entity-mapper/type/aux/hash_tuple.rb', line 27 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
22 23 24 25 |
# File 'lib/ama-entity-mapper/type/aux/hash_tuple.rb', line 22 def eql?(other) return false unless other.is_a?(HashTuple) @key == other.key && @value == other.value end |
#hash ⇒ Object
18 19 20 |
# File 'lib/ama-entity-mapper/type/aux/hash_tuple.rb', line 18 def hash @key.hash ^ @value.hash end |