Class: EPUB::ContentDocument::Navigation::Item
- Inherits:
-
Object
- Object
- EPUB::ContentDocument::Navigation::Item
- Defined in:
- lib/epub/content_document/navigation.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content_document ⇒ Object
Returns the value of attribute content_document.
-
#href ⇒ Object
Returns the value of attribute href.
-
#item ⇒ Object
Returns the value of attribute item.
-
#items ⇒ Object
Returns the value of attribute items.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes included from Hidable
Instance Method Summary collapse
-
#initialize ⇒ Item
constructor
A new instance of Item.
- #traverse(depth = 0, &block) ⇒ Object
-
#type ⇒ Object
For backward compatibility.
-
#type=(t) ⇒ Object
For backward compatibility.
Methods included from Typable
Methods included from Hidable
Constructor Details
#initialize ⇒ Item
Returns a new instance of Item.
83 84 85 86 |
# File 'lib/epub/content_document/navigation.rb', line 83 def initialize @items = ItemList.new @items.parent = self end |
Instance Attribute Details
#content_document ⇒ Object
Returns the value of attribute content_document.
79 80 81 |
# File 'lib/epub/content_document/navigation.rb', line 79 def content_document @content_document end |
#href ⇒ Object
Returns the value of attribute href.
81 82 83 |
# File 'lib/epub/content_document/navigation.rb', line 81 def href @href end |
#item ⇒ Object
Returns the value of attribute item.
79 80 81 |
# File 'lib/epub/content_document/navigation.rb', line 79 def item @item end |
#items ⇒ Object
Returns the value of attribute items.
79 80 81 |
# File 'lib/epub/content_document/navigation.rb', line 79 def items @items end |
#text ⇒ Object
Returns the value of attribute text.
79 80 81 |
# File 'lib/epub/content_document/navigation.rb', line 79 def text @text end |
Instance Method Details
#traverse(depth = 0, &block) ⇒ Object
[View source]
92 93 94 95 96 97 |
# File 'lib/epub/content_document/navigation.rb', line 92 def traverse(depth=0, &block) block.call self, depth items.each do |item| item.traverse depth + 1, &block end end |
#type ⇒ Object
For backward compatibility
100 101 102 103 104 |
# File 'lib/epub/content_document/navigation.rb', line 100 def type types.find {|t| Type::TYPES.include? t } end |
#type=(t) ⇒ Object
For backward compatibility
107 108 109 |
# File 'lib/epub/content_document/navigation.rb', line 107 def type=(t) types << t end |