Class: Mermaid::FlowchartDiagram::Node
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mermaid::FlowchartDiagram::Node
- Defined in:
- lib/mermaid/flowchart_diagram/node.rb
Constant Summary collapse
- SHAPES =
%w(default round stadium subroutine database circle double_circle asymmetric rhombus hexagon parallelogram parallelogram_alt trapezoid trapezoid_alt).freeze
- SHAPE_FORMATS =
{ 'default' => "%s[%s]", # A[Hard 'round' => "%s(%s)", # A(Hard) 'stadium' => "%s([%s])", # A([Hard]) 'subroutine' => "%s[[%s]]", # A([[Hard]]) 'database' => "%s[(%s)]", # A[(Hard)] 'circle' => "%s((%s))", # A((Hard)) 'double_circle' => "%s(((%s)))", # A(((Hard))) 'asymmetric' => "%s>%s]", # A>Hard] 'rhombus' => "%s{%s}", # A{Hard} 'hexagon' => "%s{{%s}}", # A{{Hard}} 'parallelogram' => "%s[/%s/]", # A[/Hard/] 'parallelogram_alt' => "%s[\\%s\\]", # A[\Hard\] 'trapezoid' => "%s[/%s\\]", # A[/Hard\] 'trapezoid_alt' => "%s[\\%s/]" # A[\Hard/] }.freeze
Instance Method Summary collapse
Instance Method Details
#to_s(show_label = true) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/mermaid/flowchart_diagram/node.rb', line 28 def to_s(show_label = true) if show_label format(SHAPE_FORMATS[shape], id, label) else id end end |