class Webgen::Blackboard

A blackboard object provides methods for inter-object communication. Objects may register themselves for specific messsage names and get notified when such a message gets dispatched.

For a list of all available messages have a look at the Webgen documentation page.

Public Class Methods


Create a new Blackboard object.

Public Instance Methods

add_listener(msg_name, id = nil, position = {}, &block)

Add the given block as listener for the message msg_name.

The id parameter can be used to specify a string which uniquely identifies the listener.

The position parameter can be used to specify where the listener should be added. The keys :before and :after are recognized and must contain a valid listener ID. If no key is or an unknown ID is specified, the listener is added as last entry in the listener array.

dispatch_msg(msg_name, *args)

Dispatch the message msg_name to all listeners for this message, passing the given arguments.

remove_listener(msg_names, id)

Remove the blocks associated with the given ID from the dispatcher queues of the given message names.