Class: ReVIEW::TOCParser::Paragraph

Inherits:
Node show all
Defined in:
lib/review/tocparser.rb

Instance Attribute Summary

Attributes inherited from Node

#children

Instance Method Summary collapse

Methods inherited from Node

#add_child, #chapter?, #each_child, #each_node, #each_section, #each_section_with_index, #section_size

Constructor Details

#initialize(chap) ⇒ Paragraph

Returns a new instance of Paragraph.



233
234
235
236
# File 'lib/review/tocparser.rb', line 233

def initialize(chap)
  @bytes = 0
  @page_metric = chap.book.page_metric
end

Instance Method Details

#add(line) ⇒ Object



242
243
244
# File 'lib/review/tocparser.rb', line 242

def add(line)
  @bytes += line.strip.bytesize
end

#estimated_linesObject



246
247
248
# File 'lib/review/tocparser.rb', line 246

def estimated_lines
  (@bytes + 2) / @page_metric.text.n_columns + 1
end

#inspectObject



238
239
240
# File 'lib/review/tocparser.rb', line 238

def inspect
  "#<#{self.class}>"
end

#yield_sectionObject



250
251
# File 'lib/review/tocparser.rb', line 250

def yield_section
end