Class: Ettin::Key
- Inherits:
-
Object
- Object
- Ettin::Key
- Defined in:
- lib/ettin/key.rb
Overview
Internal hash key that handles strings and symbols as the same type.
Instance Method Summary collapse
- #class ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(key) ⇒ Key
constructor
A new instance of Key.
- #inspect ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(key) ⇒ Key
Returns a new instance of Key.
8 9 10 |
# File 'lib/ettin/key.rb', line 8 def initialize(key) @key = key end |
Instance Method Details
#class ⇒ Object
16 17 18 |
# File 'lib/ettin/key.rb', line 16 def class Symbol end |
#eql?(other) ⇒ Boolean Also known as: ==
28 29 30 |
# File 'lib/ettin/key.rb', line 28 def eql?(other) to_sym == other.to_s.to_sym end |
#hash ⇒ Object
33 34 35 |
# File 'lib/ettin/key.rb', line 33 def hash key.to_s.to_sym.hash end |
#inspect ⇒ Object
12 13 14 |
# File 'lib/ettin/key.rb', line 12 def inspect to_sym.inspect end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/ettin/key.rb', line 20 def to_s key.to_s end |
#to_sym ⇒ Object
24 25 26 |
# File 'lib/ettin/key.rb', line 24 def to_sym to_s.to_sym end |