Class: Pdftotext::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/pdftotext/cli.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :layout => true
}

Instance Method Summary collapse

Instance Method Details

#run_command(*args) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/pdftotext/cli.rb', line 8

def run_command(*args)
  options = DEFAULT_OPTIONS.merge(args.pop)
  args = args.concat options_to_args(options)
  output, status = Open3.capture2e(bin_path, *args)
  raise "Command `#{bin_path} #{args.join(" ")}` failed: #{output}" if status.exitstatus != 0
  output
end