Class: Repub::Epub::Toc::NavMap::NavPoint
- Defined in:
- lib/repub/epub/toc.rb
Instance Attribute Summary collapse
-
#src ⇒ Object
Returns the value of attribute src.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_nav_point(title, src) ⇒ Object
- #calc_depth_and_play_order(nav_map, depth) ⇒ Object
-
#initialize(title, src) ⇒ NavPoint
constructor
A new instance of NavPoint.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(title, src) ⇒ NavPoint
Returns a new instance of NavPoint.
79 80 81 82 83 84 |
# File 'lib/repub/epub/toc.rb', line 79 def initialize(title, src) super @@last_play_order = 0 @play_order = 0 @child_points = [] end |
Instance Attribute Details
#src ⇒ Object
Returns the value of attribute src
74 75 76 |
# File 'lib/repub/epub/toc.rb', line 74 def src @src end |
#title ⇒ Object
Returns the value of attribute title
74 75 76 |
# File 'lib/repub/epub/toc.rb', line 74 def title @title end |
Instance Method Details
#add_nav_point(title, src) ⇒ Object
86 87 88 89 90 |
# File 'lib/repub/epub/toc.rb', line 86 def add_nav_point(title, src) nav_point = NavPoint.new(title, src) @child_points << nav_point nav_point end |
#calc_depth_and_play_order(nav_map, depth) ⇒ Object
102 103 104 105 106 |
# File 'lib/repub/epub/toc.rb', line 102 def calc_depth_and_play_order(nav_map, depth) nav_map.depth = depth @play_order = @@last_play_order += 1 @child_points.each { |child_point| child_point.calc_depth_and_play_order(nav_map, depth + 1) } end |
#to_xml(builder) ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'lib/repub/epub/toc.rb', line 92 def to_xml(builder) builder.navPoint :id => "navPoint-#{@play_order}", :playOrder => @play_order do builder.navLabel do builder.text self.title end builder.content :src => self.src @child_points.each { |child_point| child_point.to_xml(builder) } end end |