Class: Hivent::CLI::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/hivent/cli/runner.rb

Constant Summary collapse

OPTION_PARSERS =
{
  start: StartOptionParser
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Runner

Returns a new instance of Runner.



19
20
21
22
# File 'lib/hivent/cli/runner.rb', line 19

def initialize(argv)
  @argv = argv
  @command = @argv.shift.to_s.to_sym
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
# File 'lib/hivent/cli/runner.rb', line 24

def run
  if parser = OPTION_PARSERS[@command]
    send(@command, parser.new(@command, @argv).parse)
  else
    puts help
  end
end