Class: Repub::Epub::Toc::NavMap
Defined Under Namespace
Classes: NavPoint
Instance Attribute Summary collapse
-
#depth ⇒ Object
Returns the value of attribute depth.
Instance Method Summary collapse
- #add_nav_point(title, src) ⇒ Object
- #calc_depth_and_play_order ⇒ Object
-
#initialize ⇒ NavMap
constructor
A new instance of NavMap.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize ⇒ NavMap
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
#depth ⇒ Object
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_order ⇒ Object
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 |