class Robot::Commands::Move

Constants

MOVE

Public Class Methods

call(position) click to toggle source
# File lib/robot/commands/move.rb, line 12
def self.call(position)
  {
    Robot::Directions::NORTH => position.north,
    Robot::Directions::SOUTH => position.south,
    Robot::Directions::EAST => position.east,
    Robot::Directions::WEST => position.west
  }.fetch(position.direction)
end
matches?(command) click to toggle source
# File lib/robot/commands/move.rb, line 8
def self.matches?(command)
  command == MOVE
end