lib/hexapdf/cli/command.rb in hexapdf-0.10.0 vs lib/hexapdf/cli/command.rb in hexapdf-0.11.0

- old
+ new

@@ -55,11 +55,11 @@ end end include Extensions - def initialize(*args, &block) #:nodoc: + def initialize(*args, **kwargs, &block) #:nodoc: super @out_options = OpenStruct.new @out_options.compact = true @out_options.compress_pages = false @out_options.object_streams = :preserve @@ -80,11 +80,11 @@ # Creates a HexaPDF::Document instance for the PDF file and yields it. # # If +out_file+ is given, the document is written to it after yielding. def with_document(file, password: nil, out_file: nil) #:yield: document if file == out_file - doc = HexaPDF::Document.open(file, pdf_options(password)) + doc = HexaPDF::Document.open(file, **pdf_options(password)) else file_io = File.open(file, 'rb') doc = HexaPDF::Document.new(io: file_io, **pdf_options(password)) end @@ -141,10 +141,12 @@ # Defines the optimization options. # # See: #out_options, #apply_optimization_options def define_optimization_options + options.separator("") + options.separator("Optimization options:") options.on("--[no-]compact", "Delete unnecessary PDF objects (default: " \ "#{@out_options.compact})") do |c| @out_options.compact = c end options.on("--object-streams MODE", [:generate, :preserve, :delete], @@ -174,9 +176,11 @@ # Defines the encryption options. # # See: #out_options, #apply_encryption_options def define_encryption_options + options.separator("") + options.separator("Encryption options:") options.on("--decrypt", "Remove any encryption") do @out_options.encryption = :remove end options.on("--encrypt", "Encrypt the output file") do @out_options.encryption = :add