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 72 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 76 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 82 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 86 def services_and_channels_map(destinations) destinations.reduce({}) do |result, destination| if result.has_key?(destination.service) result[destination.service] << destination.channel else result[destination.service] = [destination.channel] end result end end