Class: Idml::Composition::InsertIdml::BackingStoryMerger

Inherits:
Object
  • Object
show all
Defined in:
lib/idml/composition/insert_idml.rb

Overview

Append source's XMLElement children to dest's BackingStory via the typed BackingStory model.

Instance Method Summary collapse

Constructor Details

#initialize(dest_xml, source_xml) ⇒ BackingStoryMerger

Returns a new instance of BackingStoryMerger.



79
80
81
82
# File 'lib/idml/composition/insert_idml.rb', line 79

def initialize(dest_xml, source_xml)
  @dest_xml = dest_xml
  @source_xml = source_xml
end

Instance Method Details

#callObject



84
85
86
87
88
89
# File 'lib/idml/composition/insert_idml.rb', line 84

def call
  dest = Idml::Parts::BackingStory.from_xml(@dest_xml)
  source = Idml::Parts::BackingStory.from_xml(@source_xml)
  source.xml_story.each { |story| dest.xml_story << story }
  Idml::Parts::BackingStory.to_xml(dest)
end