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:



300
301
302
303
# File 'lib/epub/maker/publication.rb', line 300

def make
  yield self if block_given?
  self
end

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

Yields:

  • (itemref)


305
306
307
308
309
310
# File 'lib/epub/maker/publication.rb', line 305

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

#to_xml_fragment(xml) ⇒ Object



312
313
314
315
316
317
318
319
320
321
322
# File 'lib/epub/maker/publication.rb', line 312

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.join(' ') unless itemref.properties.empty?
    end
  }
  to_xml_attribute node, self, [:id, :toc, :page_progression_direction]
end