Class: Uniword::Docx::Reconciler
- Inherits:
-
Object
- Object
- Uniword::Docx::Reconciler
- Defined in:
- lib/uniword/docx/reconciler.rb
Overview
Reconciles DOCX-level invariants before serialization.
Ensures that the document’s model state is internally consistent so that the serialized output is always a valid DOCX file. Called from Docx::Package#to_zip_content before the serialization phase.
This is not an extension point – it enforces built-in invariants. For customizable validation, use Uniword::Validation::Rules instead. For user-defined requirements, use Docx::Requirement (future).
Constant Summary collapse
- CONFIG_DIR =
File.join(__dir__, "../../../config")
Instance Attribute Summary collapse
-
#applied_fixes ⇒ Object
readonly
Audit trail of fixes applied during reconciliation.
Instance Method Summary collapse
-
#initialize(package, profile: nil) ⇒ Reconciler
constructor
A new instance of Reconciler.
- #reconcile ⇒ Object
Constructor Details
#initialize(package, profile: nil) ⇒ Reconciler
Returns a new instance of Reconciler.
20 21 22 23 24 |
# File 'lib/uniword/docx/reconciler.rb', line 20 def initialize(package, profile: nil) @package = package @profile = profile @applied_fixes = [] end |
Instance Attribute Details
#applied_fixes ⇒ Object (readonly)
Audit trail of fixes applied during reconciliation. Each entry is { validity_rule:, message:, timestamp: }.
57 58 59 |
# File 'lib/uniword/docx/reconciler.rb', line 57 def applied_fixes @applied_fixes end |
Instance Method Details
#reconcile ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/uniword/docx/reconciler.rb', line 26 def reconcile # Group 1: Document body (always) reconcile_section_properties reconcile_footnotes reconcile_endnotes repair_theme # Group 2: Support parts (profile-dependent) if @profile reconcile_theme reconcile_settings reconcile_font_table reconcile_styles reconcile_numbering reconcile_web_settings reconcile_app_properties reconcile_core_properties reconcile_document_body end # Clear stored namespace plans so declare: :always scopes take effect clear_stored_namespace_plans # Group 3: Package consistency (always) reconcile_content_types reconcile_package_rels reconcile_document_rels end |