README.md in dogviz-0.0.15 vs README.md in dogviz-0.0.16

- old
+ new

@@ -1,14 +1,14 @@ # dogviz A domain object graph (**DOG**) visualisation built on [ruby-graphviz](https://github.com/glejeune/Ruby-Graphviz) and hence [Graphviz](http://www.graphviz.org/) -## Features - ## Usage +``` gem install dogviz ruby examples/dogfood.rb +``` ## Example Here is the diagram rendered by running the [dogfood example](examples/dogfood.rb) @@ -61,11 +61,10 @@ create_nested_container_example(usage) domain_object_graph end -create_dog().output svg: 'examples/dogviz-generated.svg' create_dog().output jpg: 'examples/dogviz-generated.jpg' dog_rolled_up = create_dog(classes: false) dog_rolled_up.find('a nested container').rollup! dog_rolled_up.output jpg: 'examples/dogviz-rolled-up-generated.jpg' @@ -78,7 +77,78 @@ The following output from above example shows how diagram can be simplified by *rolling up* the nested container. Note that pointers to/from contained things are handled gracefully ([i think](https://github.com/damned/dogviz/blob/master/tests/test_dogviz_graphviz_rendering.rb#L97) :/). ![generated rolled up graph from examples/dogfood.rb](/examples/dogviz-rolled-up-generated.jpg "Generated rolled up diagram") +## Other Features +### #nominate +*Containers* can **#nominate** a thing so that it is referenceable via a method call on container. +It's useful if some code somewhere builds a container with multiple thing entry points you might want to point to + +```ruby +def create_c(sys) + c = sys.container('c') + c.nominate a: c.thing('a') + c.nominate b: c.thing('b') + c +end + +c = create_c(sys) +x = sys.thing('x') +x.points_to c.a +x.points_to c.b +``` + +### #doclink + +Add a documentation link to *thing* so that url can be visited clicking on the *thing* an svg output. + +```ruby +thing.doclink("https://github.com/") +``` + +### splines + +Splines can be turned on or off by providing flag to System.new + +```ruby +System.new 'dog', splines: false +``` + +### Extendable classes + +Using standard ruby extension of **System**, **Container** and **Thing** classes, you can easily use: + - language specific to your domain + - styling specific to your types + +```ruby +module Creators + def box(name, options={}) + add Box.new(self, name, options) + end +end +class WebsiteSystem < System + include Creators +end +class Box < Container + def initialize(parent, name, options={}) + super parent, name, {style: 'filled', color: '#ffaaaa'}.merge(options) + end + def process(name) + add Process.new self, name + end +end +class Process < Thing + def initialize(parent, name) + super parent, name, style: 'filled' + end + def calls(callee, options={}) + points_to callee, options + end +end + +sys = WebsiteSystem.new 'website' +box = sys.box('website box') +box.process('nginx').calls(box.process('app')) +```