Class: Docco::Builder::SectionBuilder
- Inherits:
-
Object
- Object
- Docco::Builder::SectionBuilder
- Defined in:
- lib/docco/builder.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#sections ⇒ Object
readonly
Returns the value of attribute sections.
-
#to_path ⇒ Object
readonly
Returns the value of attribute to_path.
Instance Method Summary collapse
- #build(*args) ⇒ Object
- #id ⇒ Object
-
#initialize(root:, node:, path:, children:, info:) ⇒ SectionBuilder
constructor
A new instance of SectionBuilder.
- #level ⇒ Object
- #section? ⇒ Boolean
- #title ⇒ Object
- #title_html ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(root:, node:, path:, children:, info:) ⇒ SectionBuilder
Returns a new instance of SectionBuilder.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/docco/builder.rb', line 8 def initialize(root:, node:, path:, children:, info:) @root = root @node = node @path = path @nodes = children @sections = @nodes.filter(&:section?) @info = info @path = [*path, node.id] @to_path = @path.join('/') end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
6 7 8 |
# File 'lib/docco/builder.rb', line 6 def info @info end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
6 7 8 |
# File 'lib/docco/builder.rb', line 6 def nodes @nodes end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/docco/builder.rb', line 6 def path @path end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/docco/builder.rb', line 6 def root @root end |
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
6 7 8 |
# File 'lib/docco/builder.rb', line 6 def sections @sections end |
#to_path ⇒ Object (readonly)
Returns the value of attribute to_path.
6 7 8 |
# File 'lib/docco/builder.rb', line 6 def to_path @to_path end |
Instance Method Details
#build(*args) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/docco/builder.rb', line 26 def build(*args) case args in [template] root.link self, template, to_path in [String => path, template] root.link self, template, path end end |
#id ⇒ Object
19 |
# File 'lib/docco/builder.rb', line 19 def id = @node.id |
#level ⇒ Object
20 |
# File 'lib/docco/builder.rb', line 20 def level = @node.level |
#section? ⇒ Boolean
24 |
# File 'lib/docco/builder.rb', line 24 def section? = @node.section? |
#title ⇒ Object
22 |
# File 'lib/docco/builder.rb', line 22 def title = @node.title |
#title_html ⇒ Object
21 |
# File 'lib/docco/builder.rb', line 21 def title_html = @node.title_html |
#to_html ⇒ Object
23 |
# File 'lib/docco/builder.rb', line 23 def to_html = @node.to_html |