Class: BinnacleCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/binnacle/commands/commands.rb

Instance Method Summary collapse

Instance Method Details

#run(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/binnacle/commands/commands.rb', line 6

def run(args)
  ARGV.push(*args) if ENV["TEST_MODE"] == 'true' # testing cheat

  subcommand = args[0].downcase.to_sym if args[0]
  begin
    if subcommand
      Binnacle::Commands.send(subcommand)
    else
      Binnacle::Commands.send('help')
    end
  rescue NoMethodError => nme
    puts "I don't know the subcommand command '#{subcommand}'"
  end
end