class SyntaxTree::Mermaid::Link

by the FlowChart class.
meant to be interacted with directly, but rather used as a data structure
This class represents a link between two nodes in a flowchart. It is not

def initialize(from, to, label, type, color)

def initialize(from, to, label, type, color)
  raise unless TYPES.include?(type)
  raise if color && !COLORS.include?(color)
  @from = from
  @to = to
  @label = label
  @type = type
  @color = color
end

def render

def render
  left_side, right_side, full_side = sides
  if label
    escaped = Mermaid.escape(label)
    "#{from.id} #{left_side} #{escaped} #{right_side} #{to.id}"
  else
    "#{from.id} #{full_side} #{to.id}"
  end
end

def sides

def sides
  case type
  when :directed
    %w[-- --> -->]
  when :dotted
    %w[-. .-> -.->]
  end
end