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

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

Direct Known Subclasses

Navigation

Instance Attribute Summary collapse

Attributes included from Typable

#types

Attributes included from Hidable

#hidden, #parent

Instance Method Summary collapse

Methods included from Hidable

#hidden?

Constructor Details

#initializeItem

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_documentObject

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

#hrefObject

Returns the value of attribute href.



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

def href
  @href
end

#itemObject

Returns the value of attribute item.



79
80
81
# File 'lib/epub/content_document/navigation.rb', line 79

def item
  @item
end

#itemsObject

Returns the value of attribute items.



79
80
81
# File 'lib/epub/content_document/navigation.rb', line 79

def items
  @items
end

#textObject

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



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

#typeObject

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