lib/dispatch-rider/notification_services/base.rb in dispatch-rider-1.5.2 vs lib/dispatch-rider/notification_services/base.rb in dispatch-rider-1.5.3
- old
+ new
@@ -26,21 +26,23 @@
def channel_registrar_builder
raise NotImplementedError
end
- def publish(options)
- channels(options[:to]).each do |channel|
- channel.publish(serialize(options[:message]))
- end
+ def publish(to:, message:)
+ channels(to).each { |channel| publish_to_channel channel, message: message }
end
def channels(names)
Array(names).map { |name| channel(name) }
end
def channel(name)
raise NotImplementedError
+ end
+
+ def publish_to_channel(channel, message:)
+ channel.publish(serialize(message))
end
private
def serialize(item)