class Pione::Model::NotificationListenerModel

NotificationListenerModel is a model for pione-notification-listener. This manages recipiants lifecycle.

Attributes

recipients[R]

Public Class Methods

new() click to toggle source
Calls superclass method Rootage::Model::new
# File lib/pione/model/notification-listener-model.rb, line 8
def initialize
  super
  @recipients = []
  @lock = Mutex.new
end

Public Instance Methods

add_recipient(uri) click to toggle source

Add the URI of recipient.

# File lib/pione/model/notification-listener-model.rb, line 15
def add_recipient(uri)
  @lock.synchronize do
    unless @recipients.include?(uri)
      @recipients << uri
    end
  end
end
delete_recipient(*uris) click to toggle source

Delete the recipients.

# File lib/pione/model/notification-listener-model.rb, line 24
def delete_recipient(*uris)
  @lock.synchronize {uris.each {|uri| @recipients.delete(uri)}}
end