Class: UpdateRepo::Metrics
- Inherits:
-
Object
- Object
- UpdateRepo::Metrics
- Includes:
- Helpers
- Defined in:
- lib/update_repo/metrics.rb
Overview
Class : Metrics. This class takes care of storing the metrics for processed, failures, etc.
Instance Method Summary collapse
-
#[](key) ⇒ various
Read the metric ‘key’.
-
#[]=(key, value) ⇒ value
Set the metric ‘key’ to ‘value’.
-
#initialize(logger) ⇒ instance
constructor
Constructor for the Metrics class.
Methods included from Helpers
Constructor Details
#initialize(logger) ⇒ instance
Constructor for the Metrics class.
13 14 15 16 17 |
# File 'lib/update_repo/metrics.rb', line 13 def initialize(logger) @log = logger @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0, unchanged: 0, start_time: 0, failed_list: [] } end |
Instance Method Details
#[](key) ⇒ various
Read the metric ‘key’
22 23 24 |
# File 'lib/update_repo/metrics.rb', line 22 def [](key) @metrics[key] end |
#[]=(key, value) ⇒ value
Set the metric ‘key’ to ‘value’
30 31 32 |
# File 'lib/update_repo/metrics.rb', line 30 def []=(key, value) @metrics[key] = value end |