Class: ThomasUtils::KeyIndexer
- Inherits:
-
Object
- Object
- ThomasUtils::KeyIndexer
show all
- Includes:
- SymbolHelpers
- Defined in:
- lib/thomas_utils/key_indexer.rb
Constant Summary
SymbolHelpers::OPERATOR_MAP
Instance Attribute Summary collapse
Instance Method Summary
collapse
#child
Constructor Details
#initialize(key, index) ⇒ KeyIndexer
Returns a new instance of KeyIndexer.
7
8
9
10
|
# File 'lib/thomas_utils/key_indexer.rb', line 7
def initialize(key, index)
@key = key
@index = index
end
|
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
5
6
7
|
# File 'lib/thomas_utils/key_indexer.rb', line 5
def key
@key
end
|
Instance Method Details
#==(rhs) ⇒ Object
Also known as:
eql?
16
17
18
|
# File 'lib/thomas_utils/key_indexer.rb', line 16
def ==(rhs)
rhs.is_a?(KeyIndexer) && key == rhs.key && index == rhs.index
end
|
#hash ⇒ Object
21
22
23
|
# File 'lib/thomas_utils/key_indexer.rb', line 21
def hash
to_s.hash
end
|
#to_s ⇒ Object
12
13
14
|
# File 'lib/thomas_utils/key_indexer.rb', line 12
def to_s
"#{key}['#{index}']"
end
|