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.



39
40
41
42
# File 'lib/uniword/validation/report/verification_report.rb', line 39

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

Instance Method Details

#all_errorsObject



48
49
50
# File 'lib/uniword/validation/report/verification_report.rb', line 48

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

#all_infosObject



56
57
58
# File 'lib/uniword/validation/report/verification_report.rb', line 56

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

#all_issuesObject



44
45
46
# File 'lib/uniword/validation/report/verification_report.rb', line 44

def all_issues
  layers.flat_map(&:issues)
end

#all_noticesObject



60
61
62
# File 'lib/uniword/validation/report/verification_report.rb', line 60

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

#all_warningsObject



52
53
54
# File 'lib/uniword/validation/report/verification_report.rb', line 52

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