class DispatchRider::Publisher::ServiceChannelMapper
Attributes
destination_registrar[R]
Public Class Methods
new(destination_registrar)
click to toggle source
# File lib/dispatch-rider/publisher.rb, line 68 def initialize(destination_registrar) @destination_registrar = destination_registrar end
Public Instance Methods
map(names)
click to toggle source
# File lib/dispatch-rider/publisher.rb, line 72 def map(names) services_and_channels_map(publishing_destinations(names)) end
Private Instance Methods
publishing_destinations(names)
click to toggle source
# File lib/dispatch-rider/publisher.rb, line 78 def publishing_destinations(names) Array(names).map { |name| destination_registrar.fetch(name) } end
services_and_channels_map(destinations)
click to toggle source
# File lib/dispatch-rider/publisher.rb, line 82 def services_and_channels_map(destinations) destinations.each_with_object({}) do |destination, result| if result.has_key?(destination.service) result[destination.service] << destination.channel else result[destination.service] = [destination.channel] end end end