Class: Wurk::Stats::History
- Inherits:
-
Object
- Object
- Wurk::Stats::History
- Defined in:
- lib/wurk/stats.rb
Overview
Per-day historical processed/failed/expired counts. Reads ‘stat:processed:YYYY-MM-DD`, `stat:failed:YYYY-MM-DD`, and `stat:expired:YYYY-MM-DD` strings; missing days return 0. Range 1..1825 (5 years) mirrors upstream.
Constant Summary collapse
- MAX_DAYS =
1_825
Instance Method Summary collapse
- #expired ⇒ Object
- #failed ⇒ Object
-
#initialize(days_previous, start_date = nil, pool: nil) ⇒ History
constructor
A new instance of History.
- #processed ⇒ Object
Constructor Details
#initialize(days_previous, start_date = nil, pool: nil) ⇒ History
Returns a new instance of History.
159 160 161 162 163 164 165 |
# File 'lib/wurk/stats.rb', line 159 def initialize(days_previous, start_date = nil, pool: nil) raise ArgumentError, "days_previous must be in 1..#{MAX_DAYS}" unless (1..MAX_DAYS).cover?(days_previous) @days_previous = days_previous @start_date = start_date || ::Date.today @pool = pool end |
Instance Method Details
#expired ⇒ Object
169 |
# File 'lib/wurk/stats.rb', line 169 def expired = date_stat_hash('expired') |
#failed ⇒ Object
168 |
# File 'lib/wurk/stats.rb', line 168 def failed = date_stat_hash('failed') |
#processed ⇒ Object
167 |
# File 'lib/wurk/stats.rb', line 167 def processed = date_stat_hash('processed') |