Class: App::CLI::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/app-cli.rb

Class Method Summary collapse

Class Method Details

.dispatch(*args) ⇒ Object



22
23
24
25
26
27
# File 'lib/app-cli.rb', line 22

def self.dispatch(*args)
  handler = self.find
  handler = handler.cascading if handler.cascadable
  options = handler.options
  handler.run( Getopt::Long.getopts(*options), args )
end

.findObject



16
17
18
19
20
# File 'lib/app-cli.rb', line 16

def self.find
  subcmd = ARGV.shift
  subcmd = self.to_s+"::"+subcmd.capitalize
  eval(subcmd) if class_defined?(subcmd)
end