Skip to content

Instantly share code, notes, and snippets.

@martinos
Created January 21, 2010 23:57
Show Gist options
  • Save martinos/283350 to your computer and use it in GitHub Desktop.
Save martinos/283350 to your computer and use it in GitHub Desktop.
require 'ruby2ruby'
require 'parse_tree'
#########################
# Description: Dumps class source. Does not work for some core class.
#
# Example: MyClass.code
#
########################
require 'ruby2ruby'
class Module
def code
require 'parse_tree'
sexp = ParseTree.translate(self)
Ruby2Ruby.new.process(sexp)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment