-
-
Save Bartuz/2eb9b8637e0997766e6c to your computer and use it in GitHub Desktop.
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 Car | |
def initialize(steering_wheel, engine) | |
@wheel = steering_wheel | |
@engine = engine | |
end | |
def service! | |
clean_steering_wheel and repair_engine | |
end | |
private | |
attr_reader :steering_wheel, :engine | |
def clean_steering_wheel | |
steering_wheel.do_stuff! | |
# more stuff | |
end | |
def repair_engine | |
engine.do_stuff! | |
# more stuff | |
end | |
end |
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 Car | |
def initialize(steering_wheel, engine) | |
@wheel = steering_wheel | |
@engine = engine | |
end | |
def service! | |
clean_steering_wheel(wheel) and repair_engine(engine) | |
end | |
private | |
attr_reader :steering_wheel, :engine | |
def clean_steering_wheel(wheel) | |
steering_wheel.do_stuff! | |
# more stuff | |
end | |
def repair_engine(engine) | |
engine.do_stuff! | |
# more stuff | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment