Module: RailsERD::Diagram::Graphviz::Simple

Included in:
Bachman, Crowsfoot, Uml
Defined in:
lib/rails_erd/diagram/graphviz.rb

Instance Method Summary collapse

Instance Method Details

#entity_style(entity, attributes) ⇒ Object



101
102
103
104
105
# File 'lib/rails_erd/diagram/graphviz.rb', line 101

def entity_style(entity, attributes)
  {}.tap do |options|
    options[:fontcolor] = options[:color] = :grey60 if entity.virtual?
  end
end

#relationship_style(relationship) ⇒ Object



107
108
109
110
111
112
113
114
115
# File 'lib/rails_erd/diagram/graphviz.rb', line 107

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

    # Closed arrows for to/from many.
    options[:arrowhead] = relationship.to_many? ? "normal" : "none"
    options[:arrowtail] = relationship.many_to? ? "normal" : "none"
  end
end

#specialization_style(specialization) ⇒ Object



117
118
119
120
121
122
# File 'lib/rails_erd/diagram/graphviz.rb', line 117

def specialization_style(specialization)
  { color:     :grey60,
    arrowtail: :onormal,
    arrowhead: :none,
    arrowsize: 1.2 }
end