Class: PdfOutlineEditor::Runner
- Inherits:
-
Object
- Object
- PdfOutlineEditor::Runner
- Defined in:
- lib/pdf_outline_editor/runner.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Runner
Returns a new instance of Runner.
19 20 21 22 23 24 25 |
# File 'lib/pdf_outline_editor/runner.rb', line 19 def initialize(argv) @argv = argv @parser = nil parser.order!(@argv) end |
Instance Method Details
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pdf_outline_editor/runner.rb', line 27 def run raise Error, "missing a command: available commands are #{Runner.known_commands.keys.sort.join(', ')}" if @argv.empty? command_name = @argv.shift command_class = Runner.known_commands[command_name.to_sym] raise Error, "unknown command: #{command_name}" unless command_class command = command_class.new(@argv) command.run end |