Method: Pablo::Command#parse
- Defined in:
- lib/pablo/command.rb
#parse(args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/pablo/command.rb', line 33 def parse args name = nil idx = args.zip((0...args.length).to_a).find_index { |(a,i)| verifies?(a,i) and (name = matches?(a)) } unless idx.nil? args.consume idx args.slice idx @pablo.commands[name] = true unless returning(consume?(name, args)) { run?(args) } args.consume_all if @toplevel and @opts[:consume_all] end args.unslice true else false end end |