Class: Robot::CommandCentre

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/robot/command_centre.rb

Defined Under Namespace

Classes: Command

Constant Summary collapse

COMMANDS =
%w(PLACE MOVE LEFT RIGHT REPORT)

Instance Method Summary collapse

Instance Method Details

#parse_and_execute(command_string) ⇒ Object



9
10
11
12
13
# File 'lib/robot/command_centre.rb', line 9

def parse_and_execute(command_string)
  command = Command.new(command_string.strip.upcase)
  return unless command.validate
  command.execute
end

#say(message) ⇒ Object

feature just for fun only for mac users



17
18
19
20
21
# File 'lib/robot/command_centre.rb', line 17

def say(message)
  IO.popen(
    "say -v Ralph '#{message}'"
  ) if RbConfig::CONFIG['host_os'].match(/darwin|mac os/)
end