Class: Baykit::BayServer::Common::VehicleRunner

Inherits:
Object
  • Object
show all
Includes:
Agent
Defined in:
lib/baykit/bayserver/common/vehicle_runner.rb

Defined Under Namespace

Classes: AgentListener, VehicleService

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVehicleRunner

Returns a new instance of VehicleRunner.



104
105
106
107
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 104

def initialize
  @max_vehicles = 0
  @services = []
end

Instance Attribute Details

#max_vehiclesObject (readonly)

Returns the value of attribute max_vehicles.



101
102
103
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 101

def max_vehicles
  @max_vehicles
end

#servicesObject (readonly)

Returns the value of attribute services.



102
103
104
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 102

def services
  @services
end

Instance Method Details

#init(max) ⇒ Object

Custom methods



112
113
114
115
116
117
118
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 112

def init(max)
  if(max <= 0)
    raise Sink.new()
  end
  @max_vehicles = max
  GrandAgent.add_lifecycle_listener(AgentListener.new(self))
end

#post(agt_id, vcl) ⇒ Object



120
121
122
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 120

def post(agt_id, vcl)
  @services[agt_id - 1].submit(vcl)
end