0948533da7
"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>
29 lines
442 B
Ruby
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
|