Guest User

Untitled

a guest
Aug 19th, 2012
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. require 'graph'
  2. module Orcl
  3. class Element
  4. def node(g)
  5. g.rect + g.filled + graph(g) << g.node(name)
  6. deps.each { |d| g.edge name, d.name }
  7. end
  8. end
  9. class Table
  10. def graph(g) g.c1 end
  11. end
  12. class View
  13. def graph(g) g.c2 end
  14. end
  15. class MaterializedView
  16. def graph(g) g.c3 end
  17. end
  18.  
  19. class Schema
  20. def graph
  21. s = self
  22. digraph do
  23. rotate
  24. colorscheme :accent , 3
  25. s.tabloid.each { |t| t.node self }
  26. # graph_attribs << p("{ rank=same; #{s.table.map( &:name ).join(' ')}}")
  27. same_rank s.table.map( &:name )
  28. save "schema/mxofm", "pdf"
  29. end
  30. :done
  31. end
  32. end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment