Class: Toy::Direction

Inherits:
Object
  • Object
show all
Defined in:
lib/toy/direction.rb

Defined Under Namespace

Modules: Error

Constant Summary collapse

NORTH =
:north
EAST =
:east
SOUTH =
:south
WEST =
:west
DIRECTION =
[NORTH, EAST, SOUTH, WEST]

Class Method Summary collapse

Class Method Details

.rotate_left(direction) ⇒ Object



13
14
15
# File 'lib/toy/direction.rb', line 13

def rotate_left(direction)
  element(direction, -1)
end

.rotate_right(direction) ⇒ Object



17
18
19
# File 'lib/toy/direction.rb', line 17

def rotate_right(direction)
  element(direction, 1)
end