Class: EPUB::ContentDocument::Navigation::Item

Inherits:
Object
  • Object
show all
Includes:
Hidable
Defined in:
lib/epub/content_document/navigation.rb

Direct Known Subclasses

Navigation

Instance Attribute Summary collapse

Attributes included from Hidable

#hidden, #parent

Instance Method Summary collapse

Methods included from Hidable

#hidden?

Constructor Details

#initializeItem

Returns a new instance of Item.



76
77
78
79
# File 'lib/epub/content_document/navigation.rb', line 76

def initialize
  @items = ItemList.new
  @items.parent = self
end

Instance Attribute Details

#content_documentObject

Returns the value of attribute content_document.



72
73
74
# File 'lib/epub/content_document/navigation.rb', line 72

def content_document
  @content_document
end

#hrefObject

Returns the value of attribute href.



74
75
76
# File 'lib/epub/content_document/navigation.rb', line 74

def href
  @href
end

#itemObject

Returns the value of attribute item.



72
73
74
# File 'lib/epub/content_document/navigation.rb', line 72

def item
  @item
end

#itemsObject

Returns the value of attribute items.



72
73
74
# File 'lib/epub/content_document/navigation.rb', line 72

def items
  @items
end

#textObject

Returns the value of attribute text.



72
73
74
# File 'lib/epub/content_document/navigation.rb', line 72

def text
  @text
end

Instance Method Details

#traverse(depth = 0, &block) ⇒ Object



85
86
87
88
89
90
# File 'lib/epub/content_document/navigation.rb', line 85

def traverse(depth=0, &block)
  block.call self, depth
  items.each do |item|
    item.traverse depth + 1, &block
  end
end