Created
June 22, 2012 13:06
-
-
Save carlosantoniodasilva/2972634 to your computer and use it in GitHub Desktop.
Ruby include order - from right to left
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
# Include works from right to left | |
module X | |
def self.included(base) | |
puts 'include X' | |
end | |
end | |
module Y | |
def self.included(base) | |
puts 'include Y' | |
end | |
end | |
module Z | |
def self.included(base) | |
puts 'include Z' | |
end | |
end | |
class A | |
include X, Y, Z | |
end | |
=begin # output | |
include Z | |
include Y | |
include X | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment