Class: Fontisan::Models::CollectionValidationReport
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontisan::Models::CollectionValidationReport
- Defined in:
- lib/fontisan/models/collection_validation_report.rb
Overview
CollectionValidationReport aggregates validation results for all fonts in a TTC/OTC/dfont collection.
Provides collection-level summary statistics and per-font validation details with clear formatting.
Instance Method Summary collapse
-
#add_font_report(font_report) ⇒ void
Add a font report to the collection.
-
#overall_status ⇒ String
Get overall validation status for the collection.
-
#text_summary ⇒ String
Generate text summary with collection header and per-font sections.
-
#total_errors ⇒ Integer
Calculate total errors across all fonts.
-
#total_info ⇒ Integer
Calculate total info messages across all fonts.
-
#total_warnings ⇒ Integer
Calculate total warnings across all fonts.
Instance Method Details
#add_font_report(font_report) ⇒ void
This method returns an undefined value.
Add a font report to the collection
34 35 36 37 38 39 40 |
# File 'lib/fontisan/models/collection_validation_report.rb', line 34 def add_font_report(font_report) font_reports << font_report # Mark that we're no longer using the default value value_set_for(:font_reports) # Update overall validity self.valid = valid && font_report.report.valid? end |
#overall_status ⇒ String
Get overall validation status for the collection
45 46 47 48 49 50 51 52 |
# File 'lib/fontisan/models/collection_validation_report.rb', line 45 def overall_status return "invalid" unless font_reports.all? { |fr| fr.report.valid? } return "valid_with_warnings" if font_reports.any? do |fr| fr.report.has_warnings? end "valid" end |
#text_summary ⇒ String
Generate text summary with collection header and per-font sections
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fontisan/models/collection_validation_report.rb', line 57 def text_summary lines = [] lines << "Collection: #{collection_path}" lines << "Type: #{collection_type}" lines << "Fonts: #{num_fonts}" lines << "" lines << "Summary:" lines << " Total Errors: #{total_errors}" lines << " Total Warnings: #{total_warnings}" lines << " Total Info: #{total_info}" if font_reports.any? lines << "" font_reports.each do |font_report| lines << "=== Font #{font_report.font_index}: #{font_report.font_name} ===" # Indent each line of the font's report font_lines = font_report.report.text_summary.split("\n") lines.concat(font_lines) lines << "" unless font_report == font_reports.last end end lines.join("\n") end |
#total_errors ⇒ Integer
Calculate total errors across all fonts
85 86 87 |
# File 'lib/fontisan/models/collection_validation_report.rb', line 85 def total_errors font_reports.sum { |fr| fr.report.summary.errors } end |
#total_info ⇒ Integer
Calculate total info messages across all fonts
99 100 101 |
# File 'lib/fontisan/models/collection_validation_report.rb', line 99 def total_info font_reports.sum { |fr| fr.report.summary.info } end |
#total_warnings ⇒ Integer
Calculate total warnings across all fonts
92 93 94 |
# File 'lib/fontisan/models/collection_validation_report.rb', line 92 def total_warnings font_reports.sum { |fr| fr.report.summary.warnings } end |