Created
June 8, 2015 22:24
-
-
Save chrismo/d43fcfe02e2baf7e71d1 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
module Car | |
def vroom | |
'<car noise>' | |
end | |
end | |
module Boat | |
def vroom | |
'<boat noise>' | |
end | |
end | |
module Enhancer | |
def vroom | |
"<enhanced #{super}>" | |
end | |
end | |
class CarBoat | |
include Car | |
include Boat | |
end | |
class BoatCar | |
include Boat | |
include Car | |
end | |
class EnhancedCar | |
include Car | |
include Enhancer | |
end | |
puts BoatCar.new.vroom | |
puts CarBoat.new.vroom | |
puts EnhancedCar.new.vroom | |
### | |
<car noise> | |
<boat noise> | |
<enhanced <car noise>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment