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.



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

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

Instance Method Details

#add(line) ⇒ Object



254
255
256
# File 'lib/review/tocparser.rb', line 254

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

#estimated_linesObject



258
259
260
# File 'lib/review/tocparser.rb', line 258

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

#inspectObject



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

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

#yield_sectionObject



262
263
# File 'lib/review/tocparser.rb', line 262

def yield_section
end