Class: Preflight::Rules::MaxVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/preflight/rules/max_version.rb

Overview

ensure the PDF version of the file under review is not more recent than desired

Arguments: the maximum version

Usage:

class MyPreflight
  include Preflight::Profile

  rule Preflight::Rules::MaxVersion, 1.4
end

Instance Method Summary collapse

Constructor Details

#initialize(max_version) ⇒ MaxVersion

Returns a new instance of MaxVersion.


20
21
22
# File 'lib/preflight/rules/max_version.rb', line 20

def initialize(max_version)
  @max_version = max_version.to_f
end

Instance Method Details

#check_hash(ohash) ⇒ Object


24
25
26
27
28
29
30
31
# File 'lib/preflight/rules/max_version.rb', line 24

def check_hash(ohash)
  if ohash.pdf_version > @max_version
    [Issue.new("PDF version should be #{@max_version} or lower", self, :max_version     => @max_version,
                                                                       :current_version => ohash.pdf_version)]
  else
    []
  end
end