Class: Greenroom::Recorder::Tally
- Inherits:
-
Object
- Object
- Greenroom::Recorder::Tally
- Defined in:
- lib/greenroom/recorder.rb
Overview
A mutable set of counters for one experiment name. Kept separate from
Recorder itself because a single run can, in principle, touch more
than one experiment name (a misconfigured target, or a host that reuses
one job for several experiments), and each needs its own counts.
Instance Attribute Summary collapse
-
#candidate_errors ⇒ Object
Returns the value of attribute candidate_errors.
-
#comparisons ⇒ Object
Returns the value of attribute comparisons.
-
#control_errors ⇒ Object
Returns the value of attribute control_errors.
-
#ignored ⇒ Object
Returns the value of attribute ignored.
-
#mismatches ⇒ Object
Returns the value of attribute mismatches.
Instance Method Summary collapse
-
#initialize ⇒ Tally
constructor
A new instance of Tally.
-
#to_h ⇒ Object
String keys, not symbols: a Tally's hash only ever leaves this class inside
Recorder#snapshot, and that Hash must already be shaped like JSON, because it travels throughSidekiq.dump_json/load_json(which always returns string keys) on the way to and from a cursor.
Constructor Details
#initialize ⇒ Tally
Returns a new instance of Tally.
20 21 22 23 24 25 26 |
# File 'lib/greenroom/recorder.rb', line 20 def initialize @comparisons = 0 @mismatches = 0 @ignored = 0 @candidate_errors = 0 @control_errors = 0 end |
Instance Attribute Details
#candidate_errors ⇒ Object
Returns the value of attribute candidate_errors.
18 19 20 |
# File 'lib/greenroom/recorder.rb', line 18 def candidate_errors @candidate_errors end |
#comparisons ⇒ Object
Returns the value of attribute comparisons.
18 19 20 |
# File 'lib/greenroom/recorder.rb', line 18 def comparisons @comparisons end |
#control_errors ⇒ Object
Returns the value of attribute control_errors.
18 19 20 |
# File 'lib/greenroom/recorder.rb', line 18 def control_errors @control_errors end |
#ignored ⇒ Object
Returns the value of attribute ignored.
18 19 20 |
# File 'lib/greenroom/recorder.rb', line 18 def ignored @ignored end |
#mismatches ⇒ Object
Returns the value of attribute mismatches.
18 19 20 |
# File 'lib/greenroom/recorder.rb', line 18 def mismatches @mismatches end |
Instance Method Details
#to_h ⇒ Object
String keys, not symbols: a Tally's hash only ever leaves this class
inside Recorder#snapshot, and that Hash must already be shaped like
JSON, because it travels through Sidekiq.dump_json / load_json
(which always returns string keys) on the way to and from a cursor.
32 33 34 35 36 37 38 39 40 |
# File 'lib/greenroom/recorder.rb', line 32 def to_h { "comparisons" => comparisons, "mismatches" => mismatches, "ignored" => ignored, "candidate_errors" => candidate_errors, "control_errors" => control_errors } end |