At Thu, 15 Mar 2001 08:55:43 +0200 Max Ischenko wrote:



> Is there a tool which can read Ruby code and visually (as GIF, PS, etc.)
> present it? Like doxygen for C++.

> I think this can be done without need to wrote parser because of great
> Ruby's introspection facilities. With help of something like graphviz
> www.research.att.com/sw/tools/graphviz

I crafted simple walker-drawer in an hour:
#!/usr/bin/env ruby
# Attempt to create drawer

class Drawer
   def drawClasses(root)
      name = 'classes'
      title = "Classdiagram"
      file = name + '.dot'
      f = File.open(file, 'w')
      f.puts("digraph #{title} {")
      ObjectSpace.each_object(root) {|x|
         if x and x.name and x.superclass
            # dont draw SystemCallError, it clutters all space
            next if x.superclass.name == 'SystemCallError'
            f.puts "#{x.superclass.name} -> \"#{x.name}\"" 
         end
      }
      f.puts("}")
      f.close
      system("dot -Tps -o #{name}.ps #{file}")
   end
end

d = Drawer.new
d.drawClasses(Class)


I think that draw UML-like class diagrams will be also possible.
Alas, i have very limited free time. 

Any interested in this?

-- 
programming, /n./: The art of debugging a blank sheet of paper.