Class: Mermaid::FlowchartDiagram::Link

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/mermaid/flowchart_diagram/link.rb

Instance Method Summary collapse

Instance Method Details

#label_representationObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/mermaid/flowchart_diagram/link.rb', line 28

def label_representation
  ## if label is unicode return it with quotes
  ## else return it without quotes
  if label.nil?
    ''
  else
    if label.ascii_only?
      label
    else
      "\"#{label}\""
    end
  end
end

#representationObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/mermaid/flowchart_diagram/link.rb', line 17

def representation
  case type
  when 'arrow_head'
    if label.nil?
      '-->'
    else
      "-->|#{label_representation}|"
    end
  end
end

#to_sObject



42
43
44
# File 'lib/mermaid/flowchart_diagram/link.rb', line 42

def to_s
   [from, representation, to].join
end