Created
March 1, 2013 00:36
-
-
Save saimonmoore/5061455 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
module C; def self.included(base); alias :__foo :foo; define_method :foo do |*args|; puts 'dm:'; puts super(*args);puts send('__foo', *args); end; end; def foo; puts 'C';end; end | |
=> nil | |
>> A.new.foo C | |
=> nil | |
>> class A; include B; include C; end => A | |
>> A.new.foo dm: | |
B | |
C | |
=> nil | |
>> exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment