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