class PDFMeta::Command

Public Class Methods

new(path='', options={}) click to toggle source
# File lib/pdf_meta/command.rb, line 4
def initialize(path='', options={})
  raise ArgumentError  if path.empty?

  @path    = path
  @options = default_options.merge(options)
end

Public Instance Methods

run!() click to toggle source
# File lib/pdf_meta/command.rb, line 11
def run!
  runner = PDFMeta::Runner.new(command)
  if runner.success?
    PDFMeta::Parser.new(runner.output).results
  else
    raise runner.error
  end
end

Private Instance Methods

command() click to toggle source
# File lib/pdf_meta/command.rb, line 22
def command
  [@options[:command], @options[:switches], @path].compact.join(' ')
end
default_options() click to toggle source
# File lib/pdf_meta/command.rb, line 26
def default_options
  {
    command: 'pdfinfo',
    switches: nil
  }
end