Module: CommandHelper
- Included in:
- CommandParserHelper
- Defined in:
- lib/helpers/command_helper.rb
Overview
CommandHelper module
Instance Method Summary collapse
- #a_valid_place_command?(command) ⇒ Boolean
- #command_type(command) ⇒ Object
- #commands ⇒ Object
- #directions ⇒ Object
- #split_place_command(place_command) ⇒ Object
Instance Method Details
#a_valid_place_command?(command) ⇒ Boolean
6 7 8 9 10 |
# File 'lib/helpers/command_helper.rb', line 6 def a_valid_place_command?(command) return false if command.match(PLACE_COMMAND_PATTERN).nil? true end |
#command_type(command) ⇒ Object
17 18 19 20 21 |
# File 'lib/helpers/command_helper.rb', line 17 def command_type(command) return if command.nil? return PLACE if command.include? PLACE return command if COMMANDS.include? command end |
#commands ⇒ Object
27 28 29 |
# File 'lib/helpers/command_helper.rb', line 27 def commands COMMANDS end |
#directions ⇒ Object
23 24 25 |
# File 'lib/helpers/command_helper.rb', line 23 def directions DIRECTIONS end |
#split_place_command(place_command) ⇒ Object
12 13 14 15 |
# File 'lib/helpers/command_helper.rb', line 12 def split_place_command(place_command) result = place_command.match(PLACE_COMMAND_PATTERN) result&.captures end |