class Async::Container::Statistics
Tracks various statistics relating to child instances in a container.
def << other
Append another statistics instance into this one.
def << other @spawns += other.spawns @restarts += other.restarts @failures += other.failures end
def as_json(...)
Generate a hash representation of the statistics.
def as_json(...) { spawns: @spawns, restarts: @restarts, failures: @failures, } end
def failed?
Whether there have been any failures.
def failed? @failures > 0 end
def failure!
def failure! @failures += 1 end
def initialize
def initialize @spawns = 0 @restarts = 0 @failures = 0 end
def restart!
def restart! @restarts += 1 end
def spawn!
def spawn! @spawns += 1 end
def to_json(...)
Generate a JSON representation of the statistics.
def to_json(...) as_json.to_json(...) end