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


95
96
97
98
99
# File 'lib/rails_erd/diagram/graphviz.rb', line 95

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

#relationship_style(relationship) ⇒ Object


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

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


111
112
113
114
115
116
# File 'lib/rails_erd/diagram/graphviz.rb', line 111

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