Class: ReVIEW::TOCParser::Section
Direct Known Subclasses
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Attributes inherited from Node
Instance Method Summary collapse
- #display_label ⇒ Object
- #estimated_lines ⇒ Object
-
#initialize(level, label, path = nil) ⇒ Section
constructor
A new instance of Section.
- #inspect ⇒ Object
- #yield_section {|_self| ... } ⇒ Object
Methods inherited from Node
#add_child, #chapter?, #each_child, #each_node, #each_section, #each_section_with_index, #n_sections
Constructor Details
#initialize(level, label, path = nil) ⇒ Section
Returns a new instance of Section.
164 165 166 167 168 169 |
# File 'lib/review/tocparser.rb', line 164 def initialize(level, label, path = nil) super() @level = level @label = label @filename = (path ? real_filename(path) : nil) end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
181 182 183 |
# File 'lib/review/tocparser.rb', line 181 def label @label end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
180 181 182 |
# File 'lib/review/tocparser.rb', line 180 def level @level end |
Instance Method Details
#display_label ⇒ Object
183 184 185 186 187 188 189 |
# File 'lib/review/tocparser.rb', line 183 def display_label if @filename @label + ' ' + @filename else @label end end |
#estimated_lines ⇒ Object
191 192 193 |
# File 'lib/review/tocparser.rb', line 191 def estimated_lines @children.inject(0) {|sum, n| sum + n.estimated_lines } end |
#inspect ⇒ Object
199 200 201 |
# File 'lib/review/tocparser.rb', line 199 def inspect "\#<#{self.class} level=#{@level} #{@label}>" end |
#yield_section {|_self| ... } ⇒ Object
195 196 197 |
# File 'lib/review/tocparser.rb', line 195 def yield_section yield self end |