Class: Uniword::Docx::PartLoader::XmlModelLoader
- Inherits:
-
Object
- Object
- Uniword::Docx::PartLoader::XmlModelLoader
- Defined in:
- lib/uniword/docx/part_loader/xml_model_loader.rb
Overview
Loads fixed-path XML parts: parses the part's XML with the definition's loader_model and assigns the model to the definition's package attribute. Covers every part whose load is "parse one part into one attribute": the content types, all rels parts, docProps, the main document, styles, numbering, settings, font table, web settings, theme, footnotes, endnotes, and comments.
Definitions with a path_resolution rule resolve their path dynamically (main document via the package officeDocument relationship; its rels part as the sidecar of the resolved path), falling back to the definition's fixed path.
Instance Method Summary collapse
Instance Method Details
#load(context, definition) ⇒ void
This method returns an undefined value.
22 23 24 25 26 27 28 29 |
# File 'lib/uniword/docx/part_loader/xml_model_loader.rb', line 22 def load(context, definition) content = read_content(context, definition) return unless content model = definition.loader_model.from_xml(content) context.package.method(:"#{definition.package_attribute}=") .call(model) end |