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.
166 167 168 169 170 171 172 |
# File 'lib/wurk/stats.rb', line 166 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
176 |
# File 'lib/wurk/stats.rb', line 176 def expired = date_stat_hash('expired') |
#failed ⇒ Object
175 |
# File 'lib/wurk/stats.rb', line 175 def failed = date_stat_hash('failed') |
#processed ⇒ Object
174 |
# File 'lib/wurk/stats.rb', line 174 def processed = date_stat_hash('processed') |