Skip to content

Instantly share code, notes, and snippets.

@saimonmoore
Created March 1, 2013 00:36
Show Gist options
  • Save saimonmoore/5061455 to your computer and use it in GitHub Desktop.
Save saimonmoore/5061455 to your computer and use it in GitHub Desktop.
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