Created
February 7, 2013 13:16
-
-
Save valachi/4730835 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 | |
| instance_methods.each do |method_name| | |
| original_method = instance_method(method_name) | |
| define_method(original_method) { puts caller.inspect } | |
| undef_method(method_name) | |
| end | |
| def method_missing(method, *args) | |
| send method, *args | |
| end | |
| end | |
| Woman.setup_man |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment