lib/submodules/ably-ruby/lib/ably/models/message.rb in ably-rest-1.0.5 vs lib/submodules/ably-ruby/lib/ably/models/message.rb in ably-rest-1.0.6
- old
+ new
@@ -60,13 +60,15 @@
@protocol_message = options[:protocol_message]
@raw_hash_object = attributes
set_attributes_object attributes
- ensure_utf_8 :name, name, allow_nil: true
- ensure_utf_8 :client_id, client_id, allow_nil: true
- ensure_utf_8 :encoding, encoding, allow_nil: true
+ self.attributes[:name] = ensure_utf_8(:name, name, allow_nil: true) if name
+ self.attributes[:client_id] = ensure_utf_8(:client_id, client_id, allow_nil: true) if client_id
+ self.attributes[:encoding] = ensure_utf_8(:encoding, encoding, allow_nil: true) if encoding
+
+ self.attributes.freeze
end
%w( name client_id encoding ).each do |attribute|
define_method attribute do
attributes[attribute.to_sym]
@@ -143,10 +145,10 @@
def protocol_message_index
protocol_message.messages.map(&:object_id).index(self.object_id)
end
def set_attributes_object(new_attributes)
- @attributes = IdiomaticRubyWrapper(new_attributes.clone.freeze, stop_at: [:data, :extras])
+ @attributes = IdiomaticRubyWrapper(new_attributes.clone, stop_at: [:data, :extras])
end
def logger
return @logger if @logger
protocol_message.logger if protocol_message