Skip to content

Instantly share code, notes, and snippets.

@Bartuz
Created November 16, 2015 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bartuz/2eb9b8637e0997766e6c to your computer and use it in GitHub Desktop.
Save Bartuz/2eb9b8637e0997766e6c to your computer and use it in GitHub Desktop.
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
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