Class: EPUB::Publication::Package::Spine

Inherits:
Object
  • Object
show all
Includes:
ContentModel
Defined in:
lib/epub/maker/publication.rb

Instance Method Summary collapse

Methods included from ContentModel

#to_xml_attribute

Instance Method Details

#make {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



331
332
333
334
# File 'lib/epub/maker/publication.rb', line 331

def make
  yield self if block_given?
  self
end

#make_itemref {|itemref| ... } ⇒ Object

Yields:

  • (itemref)


336
337
338
339
340
341
# File 'lib/epub/maker/publication.rb', line 336

def make_itemref
  itemref = Itemref.new
  self << itemref
  yield itemref if block_given?
  itemref
end

#to_xml_fragment(xml) ⇒ Object



343
344
345
346
347
348
349
350
351
352
353
# File 'lib/epub/maker/publication.rb', line 343

def to_xml_fragment(xml)
  node = xml.spine_ {
    itemrefs.each do |itemref|
      itemref_node = xml.itemref
      to_xml_attribute itemref_node, itemref, [:idref, :id]
      itemref_node['linear'] = 'no' unless itemref.linear?
      itemref_node['properties'] = itemref.properties.to_a.join(' ') unless itemref.properties.empty?
    end
  }
  to_xml_attribute node, self, [:id, :toc, :page_progression_direction]
end