Created
March 16, 2009 03:24
-
-
Save lsegal/79687 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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