Class: ReVIEW::TOCParser::Chapter
- Defined in:
- lib/review/tocparser.rb
Instance Attribute Summary collapse
-
#chapter_id ⇒ Object
readonly
Returns the value of attribute chapter_id.
-
#number ⇒ Object
Returns the value of attribute number.
Attributes inherited from Section
Attributes inherited from Node
Instance Method Summary collapse
- #chapter? ⇒ Boolean
-
#initialize(label, chap) ⇒ Chapter
constructor
A new instance of Chapter.
- #inspect ⇒ Object
- #volume ⇒ Object
Methods inherited from Section
#estimated_lines, #yield_section
Methods inherited from Node
#add_child, #each_child, #each_node, #each_section, #each_section_with_index, #section_size
Constructor Details
#initialize(label, chap) ⇒ Chapter
Returns a new instance of Chapter.
195 196 197 198 199 200 201 202 203 |
# File 'lib/review/tocparser.rb', line 195 def initialize(label, chap) super 1, label, chap.path @chapter = chap @chapter_id = chap.id @path = chap.path @page_metric = chap.book.page_metric @volume = nil @number = nil end |
Instance Attribute Details
#chapter_id ⇒ Object (readonly)
Returns the value of attribute chapter_id.
211 212 213 |
# File 'lib/review/tocparser.rb', line 211 def chapter_id @chapter_id end |
#number ⇒ Object
Returns the value of attribute number.
205 206 207 |
# File 'lib/review/tocparser.rb', line 205 def number @number end |
Instance Method Details
#chapter? ⇒ Boolean
207 208 209 |
# File 'lib/review/tocparser.rb', line 207 def chapter? true end |
#inspect ⇒ Object
220 221 222 |
# File 'lib/review/tocparser.rb', line 220 def inspect "#<#{self.class} #{@filename}>" end |
#volume ⇒ Object
213 214 215 216 217 218 |
# File 'lib/review/tocparser.rb', line 213 def volume return @volume if @volume @volume = @chapter.volume @volume.lines = estimated_lines @volume end |