Module: CommandParserHelper

Includes:
CommandHelper
Included in:
ToyRobotController
Defined in:
lib/helpers/command_parser_helper.rb

Overview

CommandParserHelper module

Instance Method Summary collapse

Methods included from CommandHelper

#a_valid_place_command?, #command_type, #commands, #directions, #split_place_command

Instance Method Details

#parse_command(command) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/helpers/command_parser_helper.rb', line 9

def parse_command(command)
  type_of_command = command_type(command)
  return if type_of_command.nil?
  return if type_of_command == PLACE && a_valid_place_command?(command) == false

  command_object(type_of_command, command_value(command))
end