Created
August 2, 2017 04:45
-
-
Save Sihui/5b75ec6b1771176fd9559b32c4162b16 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 C2AAdapter | |
attr_reader :type_c_outlet | |
def initialize(type_c_outlet) | |
@type_c_outlet = type_c_outlet | |
end | |
def type_a_elec | |
"converting #{type_c_outlet.type_c_elec}" | |
# some electric circuit conversion | |
'15A electricity' | |
end | |
def type_a_voltage | |
"converting #{type_c_outlet.type_c_voltage}" | |
# some electric circuit conversion | |
'100 - 127 voltages' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment