lib/ably/modules/channels_collection.rb in ably-0.8.2 vs lib/ably/modules/channels_collection.rb in ably-0.8.3

- old
+ new

@@ -16,10 +16,16 @@ # @param channel_options [Hash] Channel options including the encryption options # # @return [Channel] # def get(name, channel_options = {}) - channels[name] ||= channel_klass.new(client, name, channel_options) + if channels.has_key?(name) + channels[name].tap do |channel| + channel.update_options channel_options if channel_options && !channel_options.empty? + end + else + channels[name] ||= channel_klass.new(client, name, channel_options) + end end alias_method :[], :get # Return a Channel for the given name if it exists, else the block will be called. # This method is intentionally similar to {http://ruby-doc.org/core-2.1.3/Hash.html#method-i-fetch Hash#fetch} providing a simple way to check if a channel exists or not without creating one