Method: Jazzy::DocBuilder.render_tasks

Defined in:
lib/jazzy/doc_builder.rb

.render_tasks(source_module, children) ⇒ Object

Render tasks for Mustache document

Parameters:

  • options (Config)

    Build options

  • doc_model (Hash)

    Parsed doc. @see SourceKitten.parse



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/jazzy/doc_builder.rb', line 334

def self.render_tasks(source_module, children)
  marks = children.map(&:mark).uniq.compact
  mark_names_counts = {}
  marks.map do |mark|
    mark_children = children.select { |child| child.mark == mark }
    items = mark_children.map { |child| render_item(child, source_module) }
    uid = (mark.name || 'Unnamed').to_s
    if mark_names_counts.key?(uid)
      mark_names_counts[uid] += 1
      uid += (mark_names_counts[uid]).to_s
    else
      mark_names_counts[uid] = 1
    end
    make_task(mark, uid, items)
  end
end