class ReVIEW::TextTOCPrinter
Private Instance Methods
chapnumstr(n)
click to toggle source
# File lib/review/tocprinter.rb, line 82 def chapnumstr(n) n ? sprintf('%2d.', n) : ' ' end
print_children(node)
click to toggle source
# File lib/review/tocprinter.rb, line 58 def print_children(node) return unless print?(node.level + 1) node.each_section_with_index do |section, idx| unless section.blank? print_node idx+1, section print_children section end end end
print_node(number, node)
click to toggle source
# File lib/review/tocprinter.rb, line 68 def print_node(number, node) if node.chapter? vol = node.volume @out.printf "%3s %3dKB %6dC %5dL %s (%s)\n", chapnumstr(node.number), vol.kbytes, vol.chars, vol.lines, node.label, node.chapter_id else ## for section node @out.printf "%17s %5dL %s\n", '', node.estimated_lines, " #{' ' * (node.level - 1)}#{number} #{node.label}" end end
volume_columns(level, volstr)
click to toggle source
# File lib/review/tocprinter.rb, line 86 def volume_columns(level, volstr) cols = ["", "", "", nil] cols[level - 1] = volstr cols[0, 3] # does not display volume of level-4 section end