Class: RailsERD::Diagram::Graphviz

Inherits:
RailsERD::Diagram show all
Defined in:
lib/rails_erd/diagram/graphviz.rb

Overview

Create Graphviz-based diagrams based on the domain model. For easy command line graph generation, you can use:

% rake erd

Options

The following options are supported:

filename

The file basename of the generated diagram. Defaults to ERD, or any other extension based on the file type.

filetype

The file type of the generated diagram. Defaults to pdf, which is the recommended format. Other formats may render significantly worse than a PDF file. The available formats depend on your installation of Graphviz.

notation

The cardinality notation to be used. Can be :simple or :bachman. Refer to README.rdoc or to the examples on the project homepage for more information and examples.

orientation

The direction of the hierarchy of entities. Either :horizontal or :vertical. Defaults to horizontal. The orientation of the PDF that is generated depends on the amount of hierarchy in your models.

title

The title to add at the top of the diagram. Defaults to "YourApplication domain model".

Defined Under Namespace

Modules: Bachman, Crowsfoot, Simple, Uml

Constant Summary collapse

NODE_LABEL_TEMPLATES =
{
  html:   "node.html.erb",
  record: "node.record.erb"
}
NODE_WIDTH =
130
FONTS =
Config.font_names_based_on_os.merge(RailsERD.options[:fonts])
GRAPH_ATTRIBUTES =

Default graph attributes.

{
  rankdir:     :LR,
  ranksep:     0.5,
  nodesep:     0.4,
  pad:         "0.4,0.4",
  margin:      "0,0",
  concentrate: true,
  labelloc:    :t,
  fontsize:    13,
  fontname:    FONTS[:bold],
  splines:     'spline'
}
NODE_ATTRIBUTES =

Default node attributes.

{
  shape:    "Mrecord",
  fontsize: 10,
  fontname: FONTS[:normal],
  margin:   "0.07,0.05",
  penwidth: 1.0
}
EDGE_ATTRIBUTES =

Default edge attributes.

{
  fontname:      FONTS[:normal],
  fontsize:      7,
  dir:           :both,
  arrowsize:     0.9,
  penwidth:      1.0,
  labelangle:    32,
  labeldistance: 1.8,
}
CLUSTER_ATTRIBUTES =

Default cluster attributes.

{
  margin: "10,10"
}

Instance Attribute Summary collapse

Attributes inherited from RailsERD::Diagram

#domain, #options

Method Summary

Methods inherited from RailsERD::Diagram

create, #create, #generate, #initialize, #recurse_into_relationships, #save

Constructor Details

This class inherits a constructor from RailsERD::Diagram

Instance Attribute Details

#graphObject

Returns the value of attribute graph.



181
182
183
# File 'lib/rails_erd/diagram/graphviz.rb', line 181

def graph
  @graph
end