Module: Rapid::Model::Updatable

Extended by:
Forwardable
Included in:
ModelObject
Defined in:
lib/ury_rapid/model/update_channel.rb

Overview

Mixin for classes that use an UpdateChannel

Instance Method Summary collapse

Instance Method Details

#deregister_from_updates(id) ⇒ Object


34
35
36
# File 'lib/ury_rapid/model/update_channel.rb', line 34

def deregister_from_updates(id)
  @update_channel.deregister_from_updates(id)
end

#notify_deleteObject


26
27
28
# File 'lib/ury_rapid/model/update_channel.rb', line 26

def notify_delete
  @update_channel.notify_delete(self)
end

#notify_updateObject


22
23
24
# File 'lib/ury_rapid/model/update_channel.rb', line 22

def notify_update
  @update_channel.notify_update(self)
end

#register_for_updates(&block) ⇒ Object


30
31
32
# File 'lib/ury_rapid/model/update_channel.rb', line 30

def register_for_updates(&block)
  @update_channel.register_for_updates(&block)
end

#register_update_channel(channel) ⇒ self

Registers an update channel for this object

Parameters:

  • channel (UpdateChannel)

    A channel to which objects interested in this object's updates can subscribe. The same channel may (and usually will) be shared between multiple objects; the payloads sent to the channel will uniquely identify the object in question.

Returns:

  • (self)

17
18
19
20
# File 'lib/ury_rapid/model/update_channel.rb', line 17

def register_update_channel(channel)
  @update_channel = channel || NoUpdateChannel.new
  self
end