Class: Verapdf::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/verapdf/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Validator

Returns a new instance of Validator.



8
9
10
# File 'lib/verapdf/validator.rb', line 8

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/verapdf/validator.rb', line 6

def path
  @path
end

Instance Method Details

#valid?(flavour = '1b') ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/verapdf/validator.rb', line 12

def valid?(flavour = '1b')
  output = `verapdf -f #{flavour} #{path}`
  xml = Nokogiri::XML(output)
  xml.at_xpath("//validationReport")["isCompliant"] == "true"
end