Files
fizzy/app/models/notification/push_target.rb
T
Rosa Gutierrez 0948533da7 Rename push to process on PushTarget for clearer semantics
"Push to target" reads naturally - we push the notification to the
target. "Target processes" also makes sense - the target receives
and handles the notification in its own way.

- Add class method PushTarget.process(notification) that instantiates
  and calls the instance method
- Rename instance method from push to process
- Add private push_to helper in Pushable for readable iteration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00

29 lines
442 B
Ruby

class Notification::PushTarget
attr_reader :notification
delegate :card, to: :notification
def self.process(notification)
new(notification).process
end
def initialize(notification)
@notification = notification
end
def process
return unless should_push?
perform_push
end
private
def should_push?
notification.pushable?
end
def perform_push
raise NotImplementedError
end
end