Module: DBDiagram::Diagram::Graphviz::Crowsfoot

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

Instance Method Summary collapse

Methods included from Simple

#entity_style

Instance Method Details

#relationship_style(relationship) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/db_diagram/diagram/graphviz.rb', line 118

def relationship_style(relationship)
  {}.tap do |options|
    # options[:style] = :dotted #虚线

    # 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