Module: ReVIEW::TOCRoot
- Included in:
- Book::Base, Book::ChapterSet, Book::Part
- Defined in:
- lib/review/tocparser.rb
Instance Method Summary collapse
- #chapter? ⇒ Boolean
- #each_section(&block) ⇒ Object
- #each_section_with_index ⇒ Object
- #estimated_lines ⇒ Object
- #level ⇒ Object
- #n_sections ⇒ Object
Instance Method Details
#chapter? ⇒ Boolean
296 297 298 |
# File 'lib/review/tocparser.rb', line 296 def chapter? false end |
#each_section(&block) ⇒ Object
307 308 309 310 311 |
# File 'lib/review/tocparser.rb', line 307 def each_section(&block) each_chapter do |chap| yield chap.toc end end |
#each_section_with_index ⇒ Object
300 301 302 303 304 305 |
# File 'lib/review/tocparser.rb', line 300 def each_section_with_index idx = -1 each_section do |node| yield node, (idx += 1) end end |
#estimated_lines ⇒ Object
317 318 319 |
# File 'lib/review/tocparser.rb', line 317 def estimated_lines chapters.inject(0) {|sum, chap| sum + chap.toc.estimated_lines } end |
#level ⇒ Object
292 293 294 |
# File 'lib/review/tocparser.rb', line 292 def level 0 end |
#n_sections ⇒ Object
313 314 315 |
# File 'lib/review/tocparser.rb', line 313 def n_sections chapters.size end |