Class: EPUB::ContentDocument::Navigation
- Defined in:
- lib/epub/content_document/navigation.rb
Defined Under Namespace
Modules: Hidable Classes: Item, ItemList, Navigation
Instance Attribute Summary collapse
-
#navigations ⇒ Object
Returns the value of attribute navigations.
Attributes inherited from XHTML
Instance Method Summary collapse
-
#contents ⇒ Object
Enumerator version of toc.
-
#each_content ⇒ Object
iterator for #toc.
-
#each_landmark ⇒ Object
iterator for #landmark.
-
#each_page ⇒ Object
iterator for #page_list.
-
#initialize ⇒ Navigation
constructor
A new instance of Navigation.
- #landmarks ⇒ Object
- #navigation ⇒ Object
- #page_list ⇒ Object
-
#pages ⇒ Object
Enumerator version of page_list Usage: navigation.enum_for(:pages).
- #toc ⇒ Object
Methods inherited from XHTML
#nokogiri, #read, #rexml, #title, #top_level?
Constructor Details
#initialize ⇒ Navigation
Returns a new instance of Navigation.
6 7 8 9 |
# File 'lib/epub/content_document/navigation.rb', line 6 def initialize @navigations = [] super end |
Instance Attribute Details
#navigations ⇒ Object
Returns the value of attribute navigations.
4 5 6 |
# File 'lib/epub/content_document/navigation.rb', line 4 def @navigations end |
Instance Method Details
#contents ⇒ Object
Enumerator version of toc
24 25 26 |
# File 'lib/epub/content_document/navigation.rb', line 24 def contents enum_for(:each_content).to_a end |
#each_content ⇒ Object
iterator for #toc
37 38 39 40 41 |
# File 'lib/epub/content_document/navigation.rb', line 37 def each_content toc.traverse do |content, _| yield content end end |
#each_landmark ⇒ Object
iterator for #landmark
49 50 51 |
# File 'lib/epub/content_document/navigation.rb', line 49 def each_landmark raise NotImplementedError end |
#each_page ⇒ Object
iterator for #page_list
44 45 46 |
# File 'lib/epub/content_document/navigation.rb', line 44 def each_page raise NotImplementedError end |
#landmarks ⇒ Object
19 20 21 |
# File 'lib/epub/content_document/navigation.rb', line 19 def landmarks .find(&:landmarks?) end |
#navigation ⇒ Object
53 54 55 |
# File 'lib/epub/content_document/navigation.rb', line 53 def .first end |
#page_list ⇒ Object
15 16 17 |
# File 'lib/epub/content_document/navigation.rb', line 15 def page_list .find(&:page_list?) end |
#pages ⇒ Object
Enumerator version of page_list
Usage: navigation.enum_for(:pages)
30 31 32 |
# File 'lib/epub/content_document/navigation.rb', line 30 def pages raise NotImplementedError end |
#toc ⇒ Object
11 12 13 |
# File 'lib/epub/content_document/navigation.rb', line 11 def toc .find(&:toc?) end |