Class: PlanMyStuff::Reminders::Sweep
- Inherits:
-
Object
- Object
- PlanMyStuff::Reminders::Sweep
- Defined in:
- lib/plan_my_stuff/reminders/sweep.rb
Overview
Walks a single repo’s waiting issues, dispatching each to Closer when past the inactivity ceiling or Fire when a reminder is due. Called from RemindersSweepJob; no ActiveJob dependency here so the logic stays unit-testable and callable from a plain rake task.
Instance Method Summary collapse
-
#call ⇒ void
Runs the sweep.
-
#initialize(repo:, now: Time.now.utc) ⇒ Sweep
constructor
A new instance of Sweep.
Constructor Details
#initialize(repo:, now: Time.now.utc) ⇒ Sweep
Returns a new instance of Sweep.
13 14 15 16 |
# File 'lib/plan_my_stuff/reminders/sweep.rb', line 13 def initialize(repo:, now: Time.now.utc) @repo = repo @now = now.utc end |
Instance Method Details
#call ⇒ void
This method returns an undefined value.
Runs the sweep. No-op when config.reminders_enabled is false.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/plan_my_stuff/reminders/sweep.rb', line 22 def call return unless PlanMyStuff.configuration.reminders_enabled candidates.each do |issue| if Closer.should_close?(issue, now: @now) Closer.new(issue, now: @now).call elsif Fire.ready?(issue, now: @now) Fire.new(issue, now: @now).call end end end |