Module: RailsERD::Diagram::Graphviz::Bachman

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



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/rails_erd/diagram/graphviz.rb', line 141

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

    # Participation is "look-here".
    dst = relationship.source_optional? ? "odot" : "dot"
    src = relationship.destination_optional? ? "odot" : "dot"

    # Cardinality is "look-across".
    dst << "normal" if relationship.to_many?
    src << "normal" if relationship.many_to?

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