Module: RailsERD::Diagram::Graphviz::Crowsfoot

Includes:
Simple
Defined in:
lib/rails_erd/diagram/graphviz.rb

Instance Method Summary collapse

Methods included from Simple

#entity_style, #specialization_style

Instance Method Details

#relationship_style(relationship) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/rails_erd/diagram/graphviz.rb', line 127

def relationship_style(relationship)
  {}.tap do |options|
    options[:style] = :dotted if relationship.indirect?

    # Cardinality is "look-across".
    dst = +(relationship.to_many? ? "crow" : "tee")
    src = +(relationship.many_to? ? "crow" : "tee")

    # Participation is "look-across".
    dst << (relationship.destination_optional? ? "odot" : "tee")
    src << (relationship.source_optional? ? "odot" : "tee")

    options[:arrowsize] = 0.6
    options[:arrowhead], options[:arrowtail] = dst, src
  end
end