Created
September 3, 2015 17:13
-
-
Save alxjrvs/cd5abdcefede7d4acaca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'pry' | |
module Driveable | |
def go | |
"Vroom Vroom!" | |
end | |
def stop | |
"Sad." | |
end | |
def self.included(base) | |
base.extend(HasWheels) | |
end | |
module HasWheels | |
def has_wheels? | |
true | |
end | |
end | |
end | |
class Car | |
include Driveable | |
end | |
class Bus | |
include Driveable | |
end | |
class Boat | |
include Driveable | |
def go | |
"hrrbrlblblblblblblblblblblblblb" | |
end | |
end | |
class Truck < Car | |
def go | |
super + " VRRRRRRRROOOOOOOMMM" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment