Class: RubiksCube::Cubie
- Inherits:
-
Struct
- Object
- Struct
- RubiksCube::Cubie
- Defined in:
- lib/rubiks_cube/cubie.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
Instance Attribute Details
#state ⇒ Object
Returns the value of attribute state
3 4 5 |
# File 'lib/rubiks_cube/cubie.rb', line 3 def state @state end |
Instance Method Details
#==(other) ⇒ Object
4 5 6 |
# File 'lib/rubiks_cube/cubie.rb', line 4 def ==(other) state == other.state end |
#rotate ⇒ Object
13 14 15 |
# File 'lib/rubiks_cube/cubie.rb', line 13 def rotate Cubie.new(state.dup).rotate! end |
#rotate! ⇒ Object
8 9 10 11 |
# File 'lib/rubiks_cube/cubie.rb', line 8 def rotate! self.state = state.split('').rotate.join self end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/rubiks_cube/cubie.rb', line 17 def to_s state end |