Skip to content

Instantly share code, notes, and snippets.

@txus
Created October 19, 2010 06:59
Show Gist options
  • Save txus/633741 to your computer and use it in GitHub Desktop.
Save txus/633741 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'ograph'
class Foo
attr_accessor :hey
def initialize
@hey = :method
end
end
b = Foo.new
fb = {:hey => 'hello'}
a = [1,2,b, fb]
grapher = ObjectGraph.new(:ascendants => true)
grapher.graph(a)
File.open('graph.dot','w') do |file|
file.write grapher
end
`dot -T jpeg graph.dot > hey.jpg`
`open hey.jpg`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment