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.



226
227
228
229
# File 'lib/review/tocparser.rb', line 226

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

Instance Method Details

#add(line) ⇒ Object



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

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

#estimated_linesObject



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

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

#inspectObject



231
232
233
# File 'lib/review/tocparser.rb', line 231

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

#yield_sectionObject



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

def yield_section
end