Last active
January 13, 2016 18:48
-
-
Save jackphelps/a17a8311d72af22efbd5 to your computer and use it in GitHub Desktop.
Make all of a class's private instance methods public (for debugging only, obviously)
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
class Object | |
def self.publicize_methods_for_debugging | |
list = private_instance_methods(false).map{|name| ":" + name.to_s}.join(", ") | |
eval("class #{self.name}; public #{list}; end") | |
end | |
end | |
# User.publicize_methods_for_debugging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment