Module: LocoBot::Robot::Direction
- Defined in:
- lib/loco_bot/robot/direction.rb,
lib/loco_bot/robot/direction/east.rb,
lib/loco_bot/robot/direction/west.rb,
lib/loco_bot/robot/direction/north.rb,
lib/loco_bot/robot/direction/south.rb
Overview
Top-level namespace for the possible facing directions.
Defined Under Namespace
Modules: East, North, South, West
Class Method Summary collapse
-
.from_name(name) ⇒ Command
Returns a Direction class that as the same name as the given name.
-
.list ⇒ Array<String>
Returns the list of available Direction as Strings.
Class Method Details
.from_name(name) ⇒ Command
Returns a Direction class that as the same name as the given name.
19 20 21 |
# File 'lib/loco_bot/robot/direction.rb', line 19 def self.from_name(name) const_get(name.capitalize) if const_defined?(name.capitalize, false) end |
.list ⇒ Array<String>
Returns the list of available Direction as Strings.
12 13 14 |
# File 'lib/loco_bot/robot/direction.rb', line 12 def self.list constants.map(&:to_s) end |