Created
January 6, 2012 22:13
-
-
Save markmcspadden/1572652 to your computer and use it in GitHub Desktop.
Playing around with super in module includes with itchy
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
class Rubyist | |
def check_me | |
puts "Rubyist" | |
end | |
end | |
class Chef | |
end | |
module Texas | |
def check_me | |
puts "Texas" | |
super if defined?(super) | |
end | |
end | |
module Dallas | |
include Texas | |
def check_me | |
puts "Dallas" | |
super if defined?(super) | |
end | |
end | |
class Scott < Rubyist | |
include Dallas | |
def check_me | |
puts "Scott" | |
super | |
end | |
end | |
class Mark < Chef | |
include Dallas | |
def check_me | |
puts "Mark" | |
super | |
end | |
end | |
Scott.new.check_me | |
Mark.new.check_me |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment