Last active
October 26, 2017 00:46
-
-
Save Sihui/a8aced2547286a90e455b2f3fc879b59 to your computer and use it in GitHub Desktop.
Design Pattern: Adapter and Power Adapter
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
class TypeAPlug | |
attr_accessor :electricity, :voltage | |
def initialize | |
@electricity = nil | |
@voltage = nil | |
end | |
def plug_into(outlet) | |
self.electricity = outlet.type_a_elec | |
self.voltage = outlet.type_a_voltage | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment