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, html) ⇒ Object
-
#initialize ⇒ Root
constructor
A new instance of Root.
- #inspect ⇒ Object
- #section? ⇒ Boolean
- #to_html ⇒ Object
Constructor Details
#initialize ⇒ Root
Returns a new instance of Root.
8 9 10 11 |
# File 'lib/docco/parser/root.rb', line 8 def initialize @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
16 17 18 |
# File 'lib/docco/parser/root.rb', line 16 def <<(section) @nodes << section end |
#add_content(node, html) ⇒ Object
20 21 22 |
# File 'lib/docco/parser/root.rb', line 20 def add_content(node, html) @nodes << ContentNode.new(node, html) end |
#inspect ⇒ Object
13 |
# File 'lib/docco/parser/root.rb', line 13 def inspect = %(<#{self.class} [#{@nodes.size} nodes]>) |
#section? ⇒ Boolean
14 |
# File 'lib/docco/parser/root.rb', line 14 def section? = false |
#to_html ⇒ Object
24 25 26 27 28 |
# File 'lib/docco/parser/root.rb', line 24 def to_html @to_html ||= @nodes.reduce(+'') do |str, node| str << node.to_html << "\n" end end |