class Quartz::Hooks::Notifier

Overview

The Notifier provides a mechanism for broadcasting hooks during a simulation.

Hooks can be dispatched either to Procs or to Notifiable objects. They can register to a hook using the #subscribe method. Each invocation of this method registers the receiver to a given hook. Therefore, objects may register to several hooks.

A default Notifier instance is associated with Simulation instances so that objects can subscribe to simulation events.

Defined in:

quartz/hooks.cr

Instance Method Summary

Instance methods inherited from class Reference

==(other : Quartz::Any) ==

Instance methods inherited from class Object

===(other : Quartz::Any) ===

Instance Method Detail

def clear(hook : Symbol) #

Removes all entries that previously registered to the specified hook from the notifier.


[View source]
def clear #

Removes all entries from the notifier.


[View source]
def count_listeners(hook : Symbol) #

Returns the number of objects listening for the specified hook.


[View source]
def count_listeners #

Returns the total number of objects listening to hooks.


[View source]
def notify(hook : Symbol) #

Publish a given hook, so that each registered object in the receiver is notified.


[View source]
def subscribe(hook : Symbol, notifiable : Notifiable) #

Register the given notifiable to the specified hook.


[View source]
def subscribe(hook : Symbol, &block : Symbol -> ) #

Register the given block to the specified hook.


[View source]
def unsubscribe(hook : Symbol, instance : Symbol -> | Notifiable) #

Unsubscribes the specified entry from listening to the specified hook.


[View source]