Created
February 6, 2018 19:50
-
-
Save vovs03/6aafcc2a66cff81cb6460372fcd4d59a to your computer and use it in GitHub Desktop.
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
module FuelTank | |
def fill_tank(level) | |
self.fuel_tank = level | |
end | |
def fuel_level | |
self.fuel_tank | |
end | |
protected | |
attr_accessor :fuel_tank | |
end | |
class Car | |
include FuelTank | |
attr_reader :current_rpm | |
@@instances =0 | |
def self.instances | |
@@instances | |
end | |
def self.debug(log) | |
puts "!!!DEBUG: #{log }!!!!!" | |
end | |
debug "start interface" | |
def initialize | |
@current_rpm = 0 | |
@@instances += 1 | |
end | |
def start_engine | |
start_engine! if engine_stopped? | |
end | |
def engine_stopped? | |
current_rpm.zero? | |
end | |
debug " end interface" | |
protected | |
attr_writer :current_rpm | |
def initial_rpm | |
700 | |
end | |
def start_engine! | |
self.current_rpm =initial_rpm | |
end | |
#остановить двигатель | |
end | |
class Bike | |
include FuelTank | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment