Skip to content

Instantly share code, notes, and snippets.

@jackphelps
Last active January 13, 2016 18:48
Show Gist options
  • Save jackphelps/a17a8311d72af22efbd5 to your computer and use it in GitHub Desktop.
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)
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