Class: Repub::Epub::Toc::NavMap

Inherits:
Object
  • Object
show all
Defined in:
lib/repub/epub/toc.rb

Defined Under Namespace

Classes: NavPoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNavMap

Returns a new instance of NavMap.



109
110
111
112
# File 'lib/repub/epub/toc.rb', line 109

def initialize
  @nav_points = []
  @depth = 1
end

Instance Attribute Details

#depthObject

Returns the value of attribute depth.



120
121
122
# File 'lib/repub/epub/toc.rb', line 120

def depth
  @depth
end

Instance Method Details

#add_nav_point(title, src) ⇒ Object



114
115
116
117
118
# File 'lib/repub/epub/toc.rb', line 114

def add_nav_point(title, src)
  nav_point = NavPoint.new(title, src)
  @nav_points << nav_point
  nav_point
end

#calc_depth_and_play_orderObject



126
127
128
# File 'lib/repub/epub/toc.rb', line 126

def calc_depth_and_play_order
  @nav_points.each { |nav_point| nav_point.calc_depth_and_play_order(self, 1) }
end

#to_xml(builder) ⇒ Object



130
131
132
133
134
# File 'lib/repub/epub/toc.rb', line 130

def to_xml(builder)
  builder.navMap do
    @nav_points.each { |nav_point| nav_point.to_xml(builder) }
  end
end