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
294 295 296 |
# File 'lib/review/tocparser.rb', line 294 def chapter? false end |
#each_section(&block) ⇒ Object
305 306 307 308 309 |
# File 'lib/review/tocparser.rb', line 305 def each_section(&block) each_chapter do |chap| yield chap.toc end end |
#each_section_with_index ⇒ Object
298 299 300 301 302 303 |
# File 'lib/review/tocparser.rb', line 298 def each_section_with_index idx = -1 each_section do |node| yield node, (idx += 1) end end |
#estimated_lines ⇒ Object
315 316 317 |
# File 'lib/review/tocparser.rb', line 315 def estimated_lines chapters.inject(0) {|sum, chap| sum + chap.toc.estimated_lines } end |
#level ⇒ Object
290 291 292 |
# File 'lib/review/tocparser.rb', line 290 def level 0 end |
#n_sections ⇒ Object
311 312 313 |
# File 'lib/review/tocparser.rb', line 311 def n_sections chapters.size end |