lib/ably/realtime/presence/members_map.rb in ably-0.8.7 vs lib/ably/realtime/presence/members_map.rb in ably-0.8.8
- old
+ new
@@ -97,16 +97,16 @@
reset_callbacks
deferrable.fail error
end
reset_callbacks = proc do
- off &in_sync_callback
- off &failed_callback
- channel.off &failed_callback
+ off(&in_sync_callback)
+ off(&failed_callback)
+ channel.off(&failed_callback)
end
- once :in_sync, &in_sync_callback
+ once(:in_sync, &in_sync_callback)
once(:failed, &failed_callback)
channel.unsafe_once(:detaching, :detached, :failed) do |error_reason|
failed_callback.call error_reason
end
@@ -129,12 +129,26 @@
return to_enum(:each) unless block_given?
present_members.each(&block)
end
private
- attr_reader :members, :sync_serial, :presence, :absent_member_cleanup_queue
+ def members
+ @members
+ end
+ def sync_serial
+ @sync_serial
+ end
+
+ def presence
+ @presence
+ end
+
+ def absent_member_cleanup_queue
+ @absent_member_cleanup_queue
+ end
+
def channel
presence.channel
end
def client
@@ -154,12 +168,12 @@
presence_message.decode channel
update_members_and_emit_events presence_message
end
resume_sync_proc = method(:resume_sync).to_proc
- connection.on_resume &resume_sync_proc
+ connection.on_resume(&resume_sync_proc)
once(:in_sync, :failed) do
- connection.off_resume &resume_sync_proc
+ connection.off_resume(&resume_sync_proc)
end
once(:in_sync) do
clean_up_absent_members
end