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

Inherits:
Object
  • Object
show all
Includes:
Inspector::PublicationModel
Defined in:
lib/epub/publication/package/spine.rb

Defined Under Namespace

Classes: Itemref

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspector::PublicationModel

included, #inspect, #template

Constructor Details

#initializeSpine

Returns a new instance of Spine.



12
13
14
# File 'lib/epub/publication/package/spine.rb', line 12

def initialize
  @itemrefs = []
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/epub/publication/package/spine.rb', line 8

def id
  @id
end

#itemrefsObject (readonly)

Returns the value of attribute itemrefs.



10
11
12
# File 'lib/epub/publication/package/spine.rb', line 10

def itemrefs
  @itemrefs
end

#packageObject

Returns the value of attribute package.



8
9
10
# File 'lib/epub/publication/package/spine.rb', line 8

def package
  @package
end

#page_progression_directionObject

Returns the value of attribute page_progression_direction.



8
9
10
# File 'lib/epub/publication/package/spine.rb', line 8

def page_progression_direction
  @page_progression_direction
end

#tocObject

Returns the value of attribute toc.



8
9
10
# File 'lib/epub/publication/package/spine.rb', line 8

def toc
  @toc
end

Instance Method Details

#<<(itemref) ⇒ Object

Returns self.

Returns:

  • self



17
18
19
20
21
# File 'lib/epub/publication/package/spine.rb', line 17

def <<(itemref)
  itemref.spine = self
  @itemrefs << itemref
  self
end

#each_itemref {|itemref| ... } ⇒ Object, Enumerator

Returns the last value of block when block given, Enumerator when not

Yields:

  • (itemref)

Yield Parameters:

Yield Returns:

  • (Object)

    returns the last value of block

Returns:

  • (Object, Enumerator)

    returns the last value of block when block given, Enumerator when not



28
29
30
31
32
33
34
# File 'lib/epub/publication/package/spine.rb', line 28

def each_itemref
  if block_given?
    itemrefs.each {|itemref| yield itemref}
  else
    enum_for :each_itemref
  end
end

#itemsEnumerator

Returns Enumerator which yeilds Manifest::Item referred by each of #itemrefs.

Returns:



38
39
40
# File 'lib/epub/publication/package/spine.rb', line 38

def items
  itemrefs.collect {|itemref| itemref.item}
end