- Inheritance
- < Rinda::TemplateEntry < Rinda::TupleEntry < Object
A NotifyTemplateEntry is returned by TupleSpace#notify and is notified of TupleSpace changes. You may receive either your subscribed event or the ‘close’ event when iterating over notifications.
See TupleSpace#notify_event for valid notification types.
Example
ts = Rinda::TupleSpace.new observer = ts.notify 'write', [nil] Thread.start do observer.each { |t| p t } end 3.times { |i| ts.write [i] }
Outputs:
['write', [0]] ['write', [1]] ['write', [2]]
Methods
Class
Visibility | Signature |
---|---|
public | new (place, event, tuple, expires=nil) |
Instance
Visibility | Signature |
---|---|
public | each ( {|event, tuple| ...} |
public | notify (ev) |
public | pop () |
Class Method Detail
new(place, event, tuple, expires=nil)
Creates a new NotifyTemplateEntry that watches place for +event+s that match tuple.
Instance Method Detail
each( {|event, tuple| ...}
Yields event/tuple pairs until this NotifyTemplateEntry expires.
notify(ev)
Called by TupleSpace to notify this NotifyTemplateEntry of a new event.
pop()
Retrieves a notification. Raises RequestExpiredError when this NotifyTemplateEntry expires.