Clear::Model::EventManager
Inherits Reference < Object
Global storage for model lifecycle event management
This class acts as a storage and can trigger events This class a singleton.
Constants
INHERITANCE_MAP = {} of String => String
Class methods
add_inheritance(parent, child)
Map the inheritance between models. Events which belongs to parent model are triggered when child model lifecycle actions occurs
attach(klazz, direction : Symbol, event : Symbol, block : HookFunction)
Add an event for a specific class, to a specific direction (after or before), a specific event Symbol (validate, save, commit...)
has_trigger?(klazz, direction : Symbol, event : Symbol)
SourceTrigger events callback for a specific model.
Direction can be :before and :after
In case of :before direction, the events are called in reverse order:
before:
- Last defined event
- First defined event
action
after:
- First defined events
- Last defined events