lib/legion/transport/message.rb in legion-transport-1.1.4 vs lib/legion/transport/message.rb in legion-transport-1.1.5

- old
+ new

@@ -9,12 +9,10 @@ end def publish(options = @options) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity raise unless @valid - $exchanges = {} if $exchanges.nil? - $exchanges[exchange.to_s] = exchange.new unless $exchanges.key?(exchange.to_s) - exchange_dest = $exchanges[exchange.to_s] + exchange_dest = exchange.respond_to?(:new) ? exchange.new : exchange exchange_dest.publish(encode_message, routing_key: routing_key || '', content_type: options[:content_type] || content_type, content_encoding: options[:content_encoding] || content_encoding, type: options[:type] || type,