Class: PdfOutlineEditor::Commands::DumpCommand
- Inherits:
-
Object
- Object
- PdfOutlineEditor::Commands::DumpCommand
- Defined in:
- lib/pdf_outline_editor/commands/dump_command.rb
Instance Attribute Summary collapse
-
#input_pdf_path ⇒ Object
readonly
Returns the value of attribute input_pdf_path.
-
#output_format ⇒ Object
readonly
Returns the value of attribute output_format.
Instance Method Summary collapse
-
#initialize(argv) ⇒ DumpCommand
constructor
A new instance of DumpCommand.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ DumpCommand
Returns a new instance of DumpCommand.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pdf_outline_editor/commands/dump_command.rb', line 10 def initialize(argv) @parser = nil @output_formats = i[json yaml] @output_format = :json @input_pdf_path = nil parser.parse!(argv) handle_args(argv) end |
Instance Attribute Details
#input_pdf_path ⇒ Object (readonly)
Returns the value of attribute input_pdf_path.
8 9 10 |
# File 'lib/pdf_outline_editor/commands/dump_command.rb', line 8 def input_pdf_path @input_pdf_path end |
#output_format ⇒ Object (readonly)
Returns the value of attribute output_format.
8 9 10 |
# File 'lib/pdf_outline_editor/commands/dump_command.rb', line 8 def output_format @output_format end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/pdf_outline_editor/commands/dump_command.rb', line 23 def run Dumper.open(@input_pdf_path) do |dumper| outlines = dumper.dump puts send("convert_to_#{@output_format}", outlines) if outlines end end |