Class: RobotInterface::Help

Inherits:
Command
  • Object
show all
Defined in:
lib/rubbot_cli.rb

Constant Summary

Constants inherited from Command

Command::NoArgumentsError

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from RobotInterface::Command

Class Method Details



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rubbot_cli.rb', line 60

def self.print_help
  help_message = <<-END.gsub(/^ {8}/, '')
    Robot Commands:
    ------------------------------------------------------
    PLACE   Places the robot at X, Y facing an orientation
      Orientations accepted: NORTH, EAST, SOUTH, WEST
      Format: 'X,Y,ORIENTATION'. i.e.: '2,3,NORTH'
    MOVE    Moves the robot in current direction
    LEFT    Turns the robot left
    RIGHT   Turns the robot right
    REPORT  Prints current state of the robot
    HELP    Prints this help message
    ------------------------------------------------------
  END
end

Instance Method Details

#execute(robot, options = {}) ⇒ Object



56
57
58
# File 'lib/rubbot_cli.rb', line 56

def execute(robot, options = {})
  options.fetch(:output) << self.class::print_help
end