Skip to content

Instantly share code, notes, and snippets.

@carlosantoniodasilva
Created June 22, 2012 13:06
Show Gist options
  • Save carlosantoniodasilva/2972634 to your computer and use it in GitHub Desktop.
Save carlosantoniodasilva/2972634 to your computer and use it in GitHub Desktop.
Ruby include order - from right to left
# 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