module Clear::Model::HasHooks

Direct including types

Defined in:

clear/model/modules/has_hooks.cr

Macro Summary

Instance Method Summary

Macro Detail

macro after(event_name, method_name) #

[View source]
macro before(event_name, method_name) #

[View source]

Instance Method Detail

def trigger_after_events(event_name) #

Triggers the events hooked after event_name


[View source]
def trigger_before_events(event_name) #

Triggers the events hooked before event_name


[View source]
def with_triggers(event_name, &) #

This performs theses operations:

  • Call triggers before the event
  • Yield the given block
  • Call triggers after the event
model.with_triggers("email_sent") do |m|
  model.send_email
end

Returns self


[View source]