Module: LocoBot::Robot::Direction::South
- Defined in:
- lib/loco_bot/robot/direction/south.rb
Overview
South direction.
Class Method Summary collapse
-
.label ⇒ String
Returns the Direction’s label.
-
.left ⇒ Direction::East
Returns the Direction at the left of this one.
-
.right ⇒ Direction::West
Returns the Direction at the right of this one.
-
.vector(x, y) ⇒ Hash
The Direction is applied to the given coordinates and returns vectorial coordinates in a Hash.
Class Method Details
.label ⇒ String
Returns the Direction’s label.
20 21 22 |
# File 'lib/loco_bot/robot/direction/south.rb', line 20 def self.label 'SOUTH' end |
.left ⇒ Direction::East
Returns the Direction at the left of this one.
8 9 10 |
# File 'lib/loco_bot/robot/direction/south.rb', line 8 def self.left Direction::East end |
.right ⇒ Direction::West
Returns the Direction at the right of this one.
14 15 16 |
# File 'lib/loco_bot/robot/direction/south.rb', line 14 def self.right Direction::West end |
.vector(x, y) ⇒ Hash
The Direction is applied to the given coordinates and returns vectorial coordinates in a Hash.
30 31 32 |
# File 'lib/loco_bot/robot/direction/south.rb', line 30 def self.vector(x, y) { x: x, y: y - 1 } end |