Class: Docco::Builder::SectionBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/docco/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#infoObject (readonly)

Returns the value of attribute info.



6
7
8
# File 'lib/docco/builder.rb', line 6

def info
  @info
end

#nodesObject (readonly)

Returns the value of attribute nodes.



6
7
8
# File 'lib/docco/builder.rb', line 6

def nodes
  @nodes
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/docco/builder.rb', line 6

def path
  @path
end

#rootObject (readonly)

Returns the value of attribute root.



6
7
8
# File 'lib/docco/builder.rb', line 6

def root
  @root
end

#sectionsObject (readonly)

Returns the value of attribute sections.



6
7
8
# File 'lib/docco/builder.rb', line 6

def sections
  @sections
end

#to_pathObject (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

#idObject



19
# File 'lib/docco/builder.rb', line 19

def id = @node.id

#levelObject



20
# File 'lib/docco/builder.rb', line 20

def level = @node.level

#section?Boolean

Returns:

  • (Boolean)


24
# File 'lib/docco/builder.rb', line 24

def section? = @node.section?

#titleObject



22
# File 'lib/docco/builder.rb', line 22

def title = @node.title

#title_htmlObject



21
# File 'lib/docco/builder.rb', line 21

def title_html = @node.title_html

#to_htmlObject



23
# File 'lib/docco/builder.rb', line 23

def to_html = @node.to_html