Class: Similatron::PdfComparisonEngine

Inherits:
ComparisonEngine show all
Defined in:
lib/similatron/pdf_comparison_engine.rb

Instance Method Summary collapse

Methods inherited from ComparisonEngine

#initialize

Constructor Details

This class inherits a constructor from Similatron::ComparisonEngine

Instance Method Details

#can_handle_mime?(mime_type) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/similatron/pdf_comparison_engine.rb', line 4

def can_handle_mime?(mime_type)
  mime_type =~ %r{application/pdf}
end

#compare(expected:, actual:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/similatron/pdf_comparison_engine.rb', line 8

def compare(expected:, actual:)
  jpg_comparison = jpg_compare(expected: expected, actual: actual)

  Comparison.new(
    expected: expected,
    actual: actual,
    score: jpg_comparison.score,
    diff: jpg_comparison.diff
  )
end