Class: Docco::Parser::Root
- Inherits:
-
Object
- Object
- Docco::Parser::Root
- Defined in:
- lib/docco/parser/root.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
- #<<(section) ⇒ Object
- #add_content(node) ⇒ Object
-
#initialize(converter) ⇒ Root
constructor
A new instance of Root.
- #inspect ⇒ Object
- #section? ⇒ Boolean
- #to_html ⇒ Object
Constructor Details
#initialize(converter) ⇒ Root
Returns a new instance of Root.
8 9 10 11 12 |
# File 'lib/docco/parser/root.rb', line 8 def initialize(converter) @converter = converter @nodes = [] @level = 0 end |
Instance Attribute Details
#level ⇒ Object (readonly)
Returns the value of attribute level.
6 7 8 |
# File 'lib/docco/parser/root.rb', line 6 def level @level end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
6 7 8 |
# File 'lib/docco/parser/root.rb', line 6 def nodes @nodes end |
Instance Method Details
#<<(section) ⇒ Object
17 18 19 |
# File 'lib/docco/parser/root.rb', line 17 def <<(section) @nodes << section end |
#add_content(node) ⇒ Object
21 22 23 |
# File 'lib/docco/parser/root.rb', line 21 def add_content(node) @nodes << ContentNode.new(@converter, node) end |
#inspect ⇒ Object
14 |
# File 'lib/docco/parser/root.rb', line 14 def inspect = %(<#{self.class} [#{@nodes.size} nodes]>) |
#section? ⇒ Boolean
15 |
# File 'lib/docco/parser/root.rb', line 15 def section? = false |
#to_html ⇒ Object
25 26 27 28 29 |
# File 'lib/docco/parser/root.rb', line 25 def to_html @to_html ||= @nodes.reduce(+'') do |str, node| str << node.to_html << "\n" end end |