Module: Mermaid::GanttDiagramRenderer

Defined in:
lib/mermaid/gantt_diagram_renderer.rb

Overview

Module containing Mermaid rendering logic for Diagrams::GanttDiagram

Instance Method Summary collapse

Instance Method Details

#to_mermaidObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/mermaid/gantt_diagram_renderer.rb', line 9

def to_mermaid
  mermaid_string = +"gantt\n"
  mermaid_string << "title #{title}\n" if title && !title.empty?
  sections.each do |section|
    # Always add section title
    mermaid_string << "section #{section.title}\n"
    section.tasks&.each { |task| mermaid_string << task.to_mermaid_fragment << "\n" }
  end
  mermaid_string.strip
end