Class: PdfMatcher::DiffPdf

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/pdf_matcher/diff_pdf.rb

Defined Under Namespace

Classes: CommandNotAvailable, UnknownDiffPdfExitCode

Instance Method Summary collapse

Constructor Details

#initializeDiffPdf

Returns a new instance of DiffPdf.



29
30
31
# File 'lib/pdf_matcher/diff_pdf.rb', line 29

def initialize
  verify_available!
end

Instance Method Details

#exec(pdf1_path, pdf2_path, output_diff: nil, options: nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pdf_matcher/diff_pdf.rb', line 33

def exec(pdf1_path, pdf2_path, output_diff: nil, options: nil)
  `diff-pdf #{build_options(output_diff, options).join(' ')} #{pdf1_path} #{pdf2_path} > /dev/null 2>&1`

  case $?.exitstatus
  when 0
    true
  when 1
    false
  else
    raise UnknownDiffPdfExitCode, $?.exitstatus
  end
end