Class: Idml::Composition::AddPageFromIdml
- Inherits:
-
Object
- Object
- Idml::Composition::AddPageFromIdml
- Defined in:
- lib/idml/composition/add_page_from_idml.rb
Overview
Append a page (and its supporting spreads + stories) from a source package into a destination. Follows the same immutability pattern as InsertIdml: prefixes both sides, returns a new Package.
This is a structural implementation: it copies the source's spread files into the destination's spreads list and updates designmap to reference them. Page-item geometric reflow is deferred.
Instance Method Summary collapse
-
#call(source:, page_number:, at: nil, only: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
-
#initialize(package) ⇒ AddPageFromIdml
constructor
A new instance of AddPageFromIdml.
Constructor Details
#initialize(package) ⇒ AddPageFromIdml
Returns a new instance of AddPageFromIdml.
13 14 15 |
# File 'lib/idml/composition/add_page_from_idml.rb', line 13 def initialize(package) @package = package end |
Instance Method Details
#call(source:, page_number:, at: nil, only: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/idml/composition/add_page_from_idml.rb', line 17 def call(source:, page_number:, at: nil, only: nil) # rubocop:disable Lint/UnusedMethodArgument dest = Prefix.new(@package).call(prefix: "dest_") src = Prefix.new(source).call(prefix: "src_") parts = dest.each_part.to_a.to_h { |n, c| [n, c] } copy_source_spreads(parts, src) copy_source_stories(parts, src) rewrite_designmap(parts, dest, src) write_merged(parts) end |