Skip to content

Instantly share code, notes, and snippets.

@chrismo
Created June 8, 2015 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismo/d43fcfe02e2baf7e71d1 to your computer and use it in GitHub Desktop.
Save chrismo/d43fcfe02e2baf7e71d1 to your computer and use it in GitHub Desktop.
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