Class: Levels::Key
- Inherits:
-
Object
- Object
- Levels::Key
- Defined in:
- lib/levels/key.rb
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(key) ⇒ Key
constructor
A new instance of Key.
- #inspect ⇒ Object (also: #to_s)
- #to_sym ⇒ Object
Constructor Details
#initialize(key) ⇒ Key
4 5 6 |
# File 'lib/levels/key.rb', line 4 def initialize(key) @key = key end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
12 13 14 |
# File 'lib/levels/key.rb', line 12 def eql?(other) other.class == self.class && to_sym == other.to_sym end |
#hash ⇒ Object
18 19 20 |
# File 'lib/levels/key.rb', line 18 def hash self.class.hash ^ to_sym.hash end |
#inspect ⇒ Object Also known as: to_s
22 23 24 |
# File 'lib/levels/key.rb', line 22 def inspect "<Levels::Key #{to_sym.inspect}>" end |
#to_sym ⇒ Object
8 9 10 |
# File 'lib/levels/key.rb', line 8 def to_sym @key.to_sym end |