Last active
December 19, 2015 10:09
-
-
Save marioaquino/5938584 to your computer and use it in GitHub Desktop.
The Pilotable proxy to the Drone (uses Forwardable to achieve ISP)
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 'forwardable' | |
class Pilotable | |
extend Forwardable | |
def_delegators :@aircraft, :take_off, :land, :fly_to | |
def initialize(aircraft) | |
@aircraft = aircraft | |
end | |
end | |
client_of_drone = Pilotable.new(Drone.new) | |
client_of_drone.take_off # works | |
client_of_drone.fly_to 10, 201, 20 # works | |
client_of_drone.launch_missiles_at 10, 201, 0 #(NoMethodError): undefined method `launch_missiles_at' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment