Module | Test::Unit::Util::Observable |
In: |
lib/test/unit/util/observable.rb
|
This is a utility class that allows anything mixing it in to notify a set of listeners about interesting events.
NOTHING | = | "NOTHING/#{__id__}" | We use this for defaults since nil might mean something |
Adds the passed proc as a listener on the channel indicated by channel_name. listener_key is used to remove the listener later; if none is specified, the proc itself is used.
Whatever is used as the listener_key is returned, making it very easy to use the proc itself as the listener_key:
listener = add_listener("Channel") { ... } remove_listener("Channel", listener)
Calls all the procs registered on the channel indicated by channel_name. If value is specified, it is passed in to the procs, otherwise they are called with no arguments.