Class: Uniword::Validation::Report::VerificationReport

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/uniword/validation/report/verification_report.rb

Overview

Full verification report for a DOCX file.

Aggregates results from all validation layers (OPC, XSD, Word Document). Serializable to JSON and YAML via lutaml-model.

Examples:

Create a report

report = VerificationReport.new(
  file_path: "document.docx",
  valid: true,
  duration_ms: 80,
  layers: [layer1, layer2, layer3]
)
puts report.to_json

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VerificationReport

Returns a new instance of VerificationReport.



37
38
39
40
# File 'lib/uniword/validation/report/verification_report.rb', line 37

def initialize(attributes = {})
  super
  self.timestamp ||= Time.now.utc.iso8601
end

Instance Method Details

#all_errorsObject



46
47
48
# File 'lib/uniword/validation/report/verification_report.rb', line 46

def all_errors
  all_issues.select(&:error?)
end

#all_infosObject



54
55
56
# File 'lib/uniword/validation/report/verification_report.rb', line 54

def all_infos
  all_issues.select(&:info?)
end

#all_issuesObject



42
43
44
# File 'lib/uniword/validation/report/verification_report.rb', line 42

def all_issues
  layers.flat_map(&:issues)
end

#all_noticesObject



58
59
60
# File 'lib/uniword/validation/report/verification_report.rb', line 58

def all_notices
  all_issues.select(&:notice?)
end

#all_warningsObject



50
51
52
# File 'lib/uniword/validation/report/verification_report.rb', line 50

def all_warnings
  all_issues.select(&:warning?)
end