Created
February 7, 2013 13:25
-
-
Save valachi/4730881 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Man | |
| def self.setup | |
| puts caller.inspect | |
| puts 'im a man' | |
| end | |
| end | |
| class Woman | |
| def self.setup_man | |
| Man.setup | |
| end | |
| end | |
| class << Man | |
| puts instance_methods.inspect | |
| instance_methods.each do |method_name| | |
| original_method = instance_method(method_name) | |
| undef_method(method_name) | |
| define_method(method_name) { puts caller.inspect; send original_method } | |
| end | |
| end | |
| Woman.setup_man |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment