Created
July 16, 2009 16:11
-
-
Save rfunduk/148507 to your computer and use it in GitHub Desktop.
This file contains 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
# http://use.perl.org/~Ovid/journal/39301 | |
module MixinUpper | |
def a; 'A'; end | |
def b; 'B'; end | |
end | |
module MixinLower | |
def a; 'a'; end | |
def b; 'b'; end | |
end | |
module MixinUpperProxy | |
include MixinUpper | |
alias :upper_a :a | |
alias :upper_b :b | |
end | |
class Mixer | |
include MixinUpperProxy | |
include MixinLower | |
end | |
mixer = Mixer.new | |
puts mixer.a #=> a | |
puts mixer.b #=> a | |
puts mixer.upper_a #=> A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment