lib/submodules/ably-ruby/lib/ably/models/presence_message.rb in ably-rest-1.0.5 vs lib/submodules/ably-ruby/lib/ably/models/presence_message.rb in ably-rest-1.0.6
- old
+ new
@@ -67,13 +67,15 @@
@protocol_message = options[:protocol_message]
@raw_hash_object = attributes
set_attributes_object attributes
- ensure_utf_8 :client_id, client_id, allow_nil: true
- ensure_utf_8 :connection_id, connection_id, allow_nil: true
- ensure_utf_8 :encoding, encoding, allow_nil: true
+ self.attributes[:client_id] = ensure_utf_8(:client_id, client_id, allow_nil: true) if client_id
+ self.attributes[:connection_id] = ensure_utf_8(:connection_id, connection_id, allow_nil: true) if connection_id
+ self.attributes[:encoding] = ensure_utf_8(:encoding, encoding, allow_nil: true) if encoding
+
+ self.attributes.freeze
end
%w( client_id data encoding ).each do |attribute|
define_method attribute do
attributes[attribute.to_sym]
@@ -165,10 +167,10 @@
def protocol_message_index
protocol_message.presence.index(self)
end
def set_attributes_object(new_attributes)
- @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze, stop_at: [:data])
+ @attributes = IdiomaticRubyWrapper(new_attributes.clone, stop_at: [:data])
end
def logger
return @logger if @logger
protocol_message.logger if protocol_message