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:



327
328
329
330
# File 'lib/epub/maker/publication.rb', line 327

def make
  yield self if block_given?
  self
end

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

Yields:

  • (itemref)


332
333
334
335
336
337
# File 'lib/epub/maker/publication.rb', line 332

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

#to_xml_fragment(xml) ⇒ Object



339
340
341
342
343
344
345
346
347
348
349
# File 'lib/epub/maker/publication.rb', line 339

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