class Statistics
Tracks various statistics relating to child instances in a container.
Definitions
attr :spawns
How many child instances have been spawned.
Signature
-
attribute
Integer
attr :restarts
How many child instances have been restarted.
Signature
-
attribute
Integer
attr :failures
How many child instances have failed.
Signature
-
attribute
Integer
def spawn!
Increment the number of spawns by 1.
Implementation
def spawn!
@spawns += 1
end
def restart!
Increment the number of restarts by 1.
Implementation
def restart!
@restarts += 1
end
def failure!
Increment the number of failures by 1.
Implementation
def failure!
@failures += 1
end
def failed?
Whether there have been any failures.
Signature
-
returns
Boolean
If the failure count is greater than 0.
Implementation
def failed?
@failures > 0
end
def << other
Append another statistics instance into this one.
Signature
-
parameter
other
Statistics
The statistics to append.
Implementation
def << other
@spawns += other.spawns
@restarts += other.restarts
@failures += other.failures
end