class Async::Container::Statistics

Tracks various statistics relating to child instances in a container.

def << other

@parameter other [Statistics] The statistics to append.
Append another statistics instance into this one.
def << other
	@spawns += other.spawns
	@restarts += other.restarts
	@failures += other.failures
end

def as_json(...)

@returns [Hash] The statistics as a hash.

Generate a hash representation of the statistics.
def as_json(...)
	{
		spawns: @spawns,
		restarts: @restarts,
		failures: @failures,
	}
end

def failed?

@returns [Boolean] If the failure count is greater than 0.
Whether there have been any failures.
def failed?
	@failures > 0
end

def failure!

Increment the number of failures by 1.
def failure!
	@failures += 1
end

def initialize

Initialize the statistics all to 0.
def initialize
	@spawns = 0
	@restarts = 0
	@failures = 0
end

def restart!

Increment the number of restarts by 1.
def restart!
	@restarts += 1
end

def spawn!

Increment the number of spawns by 1.
def spawn!
	@spawns += 1
end

def to_json(...)

@returns [String] The statistics as JSON.

Generate a JSON representation of the statistics.
def to_json(...)
	as_json.to_json(...)
end