-
-
Save leejarvis/142fbbb0406dba9502c9 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
| #!/usr/bin/env ruby | |
| module M1 | |
| def foo | |
| p 'M1' | |
| end | |
| end | |
| module M2 | |
| def foo | |
| p 'M2' | |
| end | |
| end | |
| class MyClass | |
| include M1 | |
| alias_method :bar, :foo | |
| include M2 | |
| end | |
| klass = MyClass.new | |
| klass.foo #=> M2 | |
| klass.bar #=> M1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment