lib/openwfe/util/observable.rb in openwferu-0.9.12 vs lib/openwfe/util/observable.rb in openwferu-0.9.12.863

- old
+ new

@@ -28,12 +28,10 @@ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. #++ # -# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $ -# # # "made in Japan" # # John Mettraux at openwfe.org @@ -53,12 +51,16 @@ # Observers will register themselves to the Observable via # this method. # # An observer is an instance which responds to call(channel, *args) # + # Returns the observer object (or the block's Proc object), could + # be useful when removing the observer. + # def add_observer (channel, observer=nil, &callback) observer = callback unless observer (@observers[channel] ||= []) << observer + observer end # # Removes an observer (this obviously doesn't work well when # the actual observer is a block).