Class: Dbwatcher::Services::MermaidSyntax::FlowchartBuilder
- Inherits:
-
BaseBuilder
- Object
- BaseBuilder
- Dbwatcher::Services::MermaidSyntax::FlowchartBuilder
- Defined in:
- lib/dbwatcher/services/mermaid_syntax/flowchart_builder.rb
Overview
Builder for Flowchart Diagrams in Mermaid syntax
Generates Mermaid flowchart syntax from a standardized dataset with support for nodes with attributes and edges with labels.
Instance Method Summary collapse
-
#build_empty(message) ⇒ String
Build empty flowchart with message.
-
#build_from_dataset(dataset) ⇒ String
Build flowchart content from dataset.
Methods inherited from BaseBuilder
Methods included from Logging
#debug_enabled?, #log_debug, #log_error, #log_info, #log_warn
Constructor Details
This class inherits a constructor from Dbwatcher::Services::MermaidSyntax::BaseBuilder
Instance Method Details
#build_empty(message) ⇒ String
Build empty flowchart with message
43 44 45 46 47 48 49 |
# File 'lib/dbwatcher/services/mermaid_syntax/flowchart_builder.rb', line 43 def build_empty() = sanitize_text() [ "flowchart #{diagram_direction}", " EmptyState[\"#{}\"]" ].join("\n") end |
#build_from_dataset(dataset) ⇒ String
Build flowchart content from dataset
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dbwatcher/services/mermaid_syntax/flowchart_builder.rb', line 20 def build_from_dataset(dataset) lines = ["flowchart #{diagram_direction}"] # Add node definitions dataset.entities.each_value do |entity| lines << build_flowchart_node(entity) end # Add relationships unless dataset.relationships.empty? lines << "" dataset.relationships.each do |relationship| lines << build_flowchart_relationship(relationship, dataset) end end lines.join("\n") end |