Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'graph'
- module Orcl
- class Element
- def node(g)
- g.rect + g.filled + graph(g) << g.node(name)
- deps.each { |d| g.edge name, d.name }
- end
- end
- class Table
- def graph(g) g.c1 end
- end
- class View
- def graph(g) g.c2 end
- end
- class MaterializedView
- def graph(g) g.c3 end
- end
- class Schema
- def graph
- s = self
- digraph do
- rotate
- colorscheme :accent , 3
- s.tabloid.each { |t| t.node self }
- # graph_attribs << p("{ rank=same; #{s.table.map( &:name ).join(' ')}}")
- same_rank s.table.map( &:name )
- save "schema/mxofm", "pdf"
- end
- :done
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment