Class: Async::Container::Statistics
- Inherits:
-
Object
- Object
- Async::Container::Statistics
- Defined in:
- lib/async/container/statistics.rb
Instance Attribute Summary collapse
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#restarts ⇒ Object
readonly
Returns the value of attribute restarts.
-
#spawns ⇒ Object
readonly
Returns the value of attribute spawns.
Instance Method Summary collapse
- #<<(other) ⇒ Object
- #failed? ⇒ Boolean
- #failure! ⇒ Object
-
#initialize ⇒ Statistics
constructor
A new instance of Statistics.
- #restart! ⇒ Object
- #spawn! ⇒ Object
Constructor Details
#initialize ⇒ Statistics
Returns a new instance of Statistics.
28 29 30 31 32 |
# File 'lib/async/container/statistics.rb', line 28 def initialize @spawns = 0 @restarts = 0 @failures = 0 end |
Instance Attribute Details
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
36 37 38 |
# File 'lib/async/container/statistics.rb', line 36 def failures @failures end |
#restarts ⇒ Object (readonly)
Returns the value of attribute restarts.
35 36 37 |
# File 'lib/async/container/statistics.rb', line 35 def restarts @restarts end |
#spawns ⇒ Object (readonly)
Returns the value of attribute spawns.
34 35 36 |
# File 'lib/async/container/statistics.rb', line 34 def spawns @spawns end |
Instance Method Details
#<<(other) ⇒ Object
54 55 56 57 58 |
# File 'lib/async/container/statistics.rb', line 54 def << other @spawns += other.spawns @restarts += other.restarts @failures += other.failures end |
#failed? ⇒ Boolean
50 51 52 |
# File 'lib/async/container/statistics.rb', line 50 def failed? @failures > 0 end |
#failure! ⇒ Object
46 47 48 |
# File 'lib/async/container/statistics.rb', line 46 def failure! @failures += 1 end |
#restart! ⇒ Object
42 43 44 |
# File 'lib/async/container/statistics.rb', line 42 def restart! @restarts += 1 end |
#spawn! ⇒ Object
38 39 40 |
# File 'lib/async/container/statistics.rb', line 38 def spawn! @spawns += 1 end |