Class: ListTool::App::Commands
- Inherits:
-
Object
- Object
- ListTool::App::Commands
- Defined in:
- lib/list_tool/app/commands.rb
Constant Summary collapse
- COMMANDS =
ListTool::App.constants.map {|const| ListTool::App.const_get(const)} - [self, Printer, Runner, Colorizer, Command]
Class Method Summary collapse
Class Method Details
.help ⇒ Object
40 41 42 |
# File 'lib/list_tool/app/commands.rb', line 40 def help COMMANDS.inject(""){|out, cmd| out << cmd.help << "\n" } end |
.process(argv, lister) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/list_tool/app/commands.rb', line 24 def process argv, lister argv.is_a?(Array) || raise(ArgumentError, "expected first paramenter to be an Array, #{argv.class} given") argv << 'h' if argv.empty? param = argv.shift begin COMMANDS.each do |cmd| if cmd.match? param cmd.execute cmd.parse(argv), lister break end end end end |