Class: TwistyPuzzles::Puzzle
- Inherits:
-
Object
- Object
- TwistyPuzzles::Puzzle
- Defined in:
- lib/twisty_puzzles/puzzle.rb
Overview
Represents one type of puzzle.
Constant Summary collapse
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(name) ⇒ Puzzle
constructor
A new instance of Puzzle.
Constructor Details
#initialize(name) ⇒ Puzzle
Returns a new instance of Puzzle.
6 7 8 |
# File 'lib/twisty_puzzles/puzzle.rb', line 6 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/twisty_puzzles/puzzle.rb', line 13 def name @name end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
15 16 17 |
# File 'lib/twisty_puzzles/puzzle.rb', line 15 def eql?(other) self.class == other.class && name == other.name end |
#hash ⇒ Object
19 20 21 |
# File 'lib/twisty_puzzles/puzzle.rb', line 19 def hash @hash ||= [self.class, @name].hash end |