Class: EPUB::ContentDocument::Navigation
- Includes:
- Typable
- 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 included from Typable
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, #oga, #read, #rexml, #title, #top_level?
Constructor Details
#initialize ⇒ Navigation
Returns a new instance of Navigation.
10 11 12 13 14 15 |
# File 'lib/epub/content_document/navigation.rb', line 10 def initialize @navigations = [] @hidden = false @parent = nil super end |
Instance Attribute Details
#navigations ⇒ Object
Returns the value of attribute navigations.
8 9 10 |
# File 'lib/epub/content_document/navigation.rb', line 8 def @navigations end |
Instance Method Details
#contents ⇒ Object
Enumerator version of toc
30 31 32 |
# File 'lib/epub/content_document/navigation.rb', line 30 def contents enum_for(:each_content).to_a end |
#each_content ⇒ Object
iterator for #toc
43 44 45 46 47 |
# File 'lib/epub/content_document/navigation.rb', line 43 def each_content toc.traverse do |content, _| yield content end end |
#each_landmark ⇒ Object
iterator for #landmark
55 56 57 |
# File 'lib/epub/content_document/navigation.rb', line 55 def each_landmark raise NotImplementedError end |
#each_page ⇒ Object
iterator for #page_list
50 51 52 |
# File 'lib/epub/content_document/navigation.rb', line 50 def each_page raise NotImplementedError end |
#landmarks ⇒ Object
25 26 27 |
# File 'lib/epub/content_document/navigation.rb', line 25 def landmarks .find(&:landmarks?) end |
#navigation ⇒ Object
59 60 61 |
# File 'lib/epub/content_document/navigation.rb', line 59 def .first end |
#page_list ⇒ Object
21 22 23 |
# File 'lib/epub/content_document/navigation.rb', line 21 def page_list .find(&:page_list?) end |
#pages ⇒ Object
Enumerator version of page_list
Usage: navigation.enum_for(:pages)
36 37 38 |
# File 'lib/epub/content_document/navigation.rb', line 36 def pages raise NotImplementedError end |
#toc ⇒ Object
17 18 19 |
# File 'lib/epub/content_document/navigation.rb', line 17 def toc .find(&:toc?) end |