Class: Doterd::Renderer::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/doterd.rb

Class Method Summary collapse

Class Method Details

.call(relation, from, to) ⇒ Object



146
147
148
# File 'lib/doterd.rb', line 146

def self.call(relation, from, to)
  "#{from} -> #{to} #{label relation}"
end

.label(relation) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/doterd.rb', line 150

def self.label(relation)
  case relation
  when :_1_1
    "[arrowhead=odot, arrowtail=odot, dir=both]"
  when :_1_N
    "[arrowhead=inv, arrowtail=odot, dir=both]"
  when :_N_1
    "[arrowhead=odot, arrowtail=inv, dir=both]"
  when :_N_N
    "[arrowhead=inv, arrowtail=inv, dir=both]"
  else
    raise "Relation not found for #{relation}"
  end
end