- 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