Skip to content

Instantly share code, notes, and snippets.

@lsegal
Created March 16, 2009 03:24
Show Gist options
  • Save lsegal/79687 to your computer and use it in GitHub Desktop.
Save lsegal/79687 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'yard'
include YARD
def traverse(node = Registry.root, indent = 0)
# Print contents of node
if node == Registry.root
puts "root"
else
if CodeObjects::MethodObject === node
name = node.name(true) # get method name with prefix
else
name = node.name
end
puts ("| " * (indent-1)) + "|-- " + name.to_s
end
# Traverse children if there are any
if node.respond_to?(:children)
node.children.each {|child| traverse(child, indent + 1) }
end
end
Registry.load
traverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment