Class: EPUB::Publication::Package::Spine
- Inherits:
-
Object
- Object
- EPUB::Publication::Package::Spine
- Includes:
- Inspector::PublicationModel
- Defined in:
- lib/epub/publication/package/spine.rb
Defined Under Namespace
Classes: Itemref
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#itemrefs ⇒ Object
readonly
Returns the value of attribute itemrefs.
-
#package ⇒ Object
Returns the value of attribute package.
-
#page_progression_direction ⇒ Object
Returns the value of attribute page_progression_direction.
-
#toc ⇒ Object
Returns the value of attribute toc.
Instance Method Summary collapse
-
#<<(itemref) ⇒ Object
Self.
-
#each_itemref {|itemref| ... } ⇒ Object, Enumerator
Returns the last value of block when block given, Enumerator when not.
-
#initialize ⇒ Spine
constructor
A new instance of Spine.
-
#items ⇒ Enumerator
Enumerator which yeilds Manifest::Item referred by each of #itemrefs.
Methods included from Inspector::PublicationModel
Constructor Details
#initialize ⇒ Spine
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
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/epub/publication/package/spine.rb', line 8 def id @id end |
#itemrefs ⇒ Object (readonly)
Returns the value of attribute itemrefs.
10 11 12 |
# File 'lib/epub/publication/package/spine.rb', line 10 def itemrefs @itemrefs end |
#package ⇒ Object
Returns the value of attribute package.
8 9 10 |
# File 'lib/epub/publication/package/spine.rb', line 8 def package @package end |
#page_progression_direction ⇒ Object
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 |
#toc ⇒ Object
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.
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
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 |
#items ⇒ Enumerator
Returns Enumerator which yeilds Manifest::Item referred by each of #itemrefs.
38 39 40 |
# File 'lib/epub/publication/package/spine.rb', line 38 def items itemrefs.collect {|itemref| itemref.item} end |