lib/dispatch-rider/publisher.rb in dispatch-rider-2.1.0 vs lib/dispatch-rider/publisher.rb in dispatch-rider-2.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require "active_support/core_ext/hash/indifferent_access"
require_relative "publisher/configuration_support"
module DispatchRider
# This class takes care of the publishing side of the messaging system.
@@ -76,16 +78,15 @@
def publishing_destinations(names)
Array(names).map { |name| destination_registrar.fetch(name) }
end
def services_and_channels_map(destinations)
- destinations.reduce({}) do |result, destination|
+ 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
- result
end
end
end
end
end