Class: Uniword::Docx::PartLoader::CustomXmlLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/uniword/docx/part_loader/custom_xml_loader.rb

Overview

Loads customXml data items (customXml/itemN.xml) together with their itemProps and relationships sidecars into CustomXmlItem objects on the package.

Instance Method Summary collapse

Instance Method Details

#load(context, definition) ⇒ void

This method returns an undefined value.

Parameters:



13
14
15
16
17
18
19
20
21
# File 'lib/uniword/docx/part_loader/custom_xml_loader.rb', line 13

def load(context, definition)
  item_paths = context.matching_paths(definition)
  return if item_paths.empty?

  items = item_paths.sort_by { |path| item_index(path) }.map do |path|
    build_item(context, path)
  end
  context.package.custom_xml_items = items
end