Class: TwistyPuzzles::StickerCycle
- Inherits:
-
Object
- Object
- TwistyPuzzles::StickerCycle
show all
- Includes:
- ReversibleApplyable
- Defined in:
- lib/twisty_puzzles/sticker_cycle.rb
Overview
A sticker cycle that can be applied to a cube state. TODO: Deprecate
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#apply_temporarily_to, #apply_to_dupped
Constructor Details
Returns a new instance of StickerCycle.
21
22
23
24
25
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 21
def initialize(native)
raise TypeError unless native.is_a?(Native::StickerCycle)
@native = native
end
|
Instance Attribute Details
#native ⇒ Object
Returns the value of attribute native.
27
28
29
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 27
def native
@native
end
|
Class Method Details
.from_coordinates(cube_size, coordinates) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 14
def self.from_coordinates(cube_size, coordinates)
CubeState.check_cube_size(cube_size)
raise TypeError unless coordinates.all?(Coordinate)
new(Native::StickerCycle.new(cube_size, coordinates.map(&:native)))
end
|
Instance Method Details
#apply_to(cube_state) ⇒ Object
47
48
49
50
51
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 47
def apply_to(cube_state)
raise TypeError unless cube_state.is_a?(CubeState)
@native.apply_to(cube_state.native)
end
|
#cube_size ⇒ Object
39
40
41
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 39
def cube_size
@native.cube_size
end
|
#eql?(other) ⇒ Boolean
Also known as:
==
29
30
31
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 29
def eql?(other)
self.class.equal?(other.class) && @native == other.native
end
|
#hash ⇒ Object
35
36
37
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 35
def hash
@hash ||= [self.class, @native].hash
end
|
#inverse ⇒ Object
53
54
55
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 53
def inverse
StickerCycle.new(@native.inverse)
end
|
#length ⇒ Object
43
44
45
|
# File 'lib/twisty_puzzles/sticker_cycle.rb', line 43
def length
@native.length
end
|