Module: CommandFactory

Includes:
Commands
Included in:
Gdsh::Gdsh
Defined in:
lib/gdsh/command_factory.rb

Overview

Factory pattern to create the appropriate command.

Instance Method Summary collapse

Methods included from Commands

commands, interpret, puts_usage_header, usage

Instance Method Details

#next_command(params) ⇒ Object



29
30
31
# File 'lib/gdsh/command_factory.rb', line 29

def next_command(params)
  Commands.interpret(params[0])
end

#parsed_inputsObject



21
22
23
24
25
26
27
# File 'lib/gdsh/command_factory.rb', line 21

def parsed_inputs
  # gets user input, defaulting to empty and removing newline
  user_input = $stdin.gets || ''

  # if command has parameters, split it up
  user_input.chomp.split(/[\(,\),\,,\ ]/)
end