Created
July 30, 2017 01:21
-
-
Save gabidavila/693a3895a7918cdc1093de46d1ace885 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 Paintable | |
def color | |
puts "Blue" | |
super | |
end | |
end | |
class Vehicle | |
def color | |
puts "Green" | |
end | |
end | |
class Car < Vehicle | |
prepend Paintable | |
def color | |
puts "Red" | |
end | |
end | |
car = Car.new | |
car.color | |
# Blue | |
# Red | |
# => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment