lib/deepstream/list.rb in deepstream-1.0.5 vs lib/deepstream/list.rb in deepstream-1.0.6
- old
+ new
@@ -80,19 +80,20 @@
def set
@client.send_message(TOPIC::RECORD, ACTION::UPDATE, @name, (@version += 1), @data.to_json) if @version
end
def set_new_data(new_data)
+ p @data - new_data
(@data - new_data).each { |uid| notify_listeners(:removed, uid) }
(new_data - @data).each { |uid| notify_listeners(:added, uid) }
@data = new_data
end
def notify_listeners(cb_name, uid)
(@handlers[cb_name] || []).each do |proc|
record = @client.get(uid)
- if record.version
- proc.call()
+ if record.__version
+ proc.call(record)
else
record.when_ready(&proc)
end
end
end