lib/bunny/session.rb in bunny-2.3.1 vs lib/bunny/session.rb in bunny-2.4.0

- old
+ new

@@ -123,16 +123,16 @@ # @option optz [String] :locale ("PLAIN") Locale RabbitMQ should use # # @see http://rubybunny.info/articles/connecting.html Connecting to RabbitMQ guide # @see http://rubybunny.info/articles/tls.html TLS/SSL guide # @api public - def initialize(connection_string_or_opts = Hash.new, optz = Hash.new) - opts = case (ENV["RABBITMQ_URL"] || connection_string_or_opts) + def initialize(connection_string_or_opts = ENV['RABBITMQ_URL'], optz = Hash.new) + opts = case (connection_string_or_opts) when nil then Hash.new when String then - self.class.parse_uri(ENV["RABBITMQ_URL"] || connection_string_or_opts) + self.class.parse_uri(connection_string_or_opts) when Hash then connection_string_or_opts end.merge(optz) @default_hosts_shuffle_strategy = Proc.new { |hosts| hosts.shuffle } @@ -177,10 +177,10 @@ @client_channel_max = normalize_client_channel_max(opts.fetch(:channel_max, DEFAULT_CHANNEL_MAX)) # will be-renegotiated during connection tuning steps. MK. @channel_max = @client_channel_max @client_heartbeat = self.heartbeat_from(opts) - @client_properties = opts[:properties] || DEFAULT_CLIENT_PROPERTIES + @client_properties = DEFAULT_CLIENT_PROPERTIES.merge(opts.fetch(:properties, {})) @mechanism = opts.fetch(:auth_mechanism, "PLAIN") @credentials_encoder = credentials_encoder_for(@mechanism) @locale = @opts.fetch(:locale, DEFAULT_LOCALE) @mutex_impl = @opts.fetch(:mutex_impl, Monitor)