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.


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

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


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

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


80
81
82
83
84
85
# File 'lib/epub/content_document/navigation.rb', line 80

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