Graphviz::Diagram
A simple utility to create class-diagrams based on Graphviz.
Installation
Add this line to your application's Gemfile:
gem 'graphviz/diagram'
And then execute:
$ bundle
Or install it yourself as:
$ gem install graphviz-diagram
Usage
Create a diagram:
g = Graphviz::Diagram.new
g['Author'].add_attribute 'name', visibility: :private, type: 'String'
g['Author'].add_attribute 'age', visibility: :private, type: 'Age'
g['Author'].add_method 'books', type: 'Array'
g['Author'].add_method 'update', arguments: 'name, age', type: 'Boolean'
g['Book'].add_attribute 'title', type: 'String'
g['Book'].add_method 'author', type: 'Author'
g << g['Book'].belongs_to(g['Author'])
g.output png: 'book_author.png'
It create a book_author.png
file looks like:
(examples
folder contains more examples)