signals

Declare signals that resources can emit and listen to.

Nested DSLs

Examples

signals do
  signal :post_created do
    argument :post_id, :uuid, allow_nil?: false
  end
end

signals.signal

signal name

Declares a signal, and defines a struct for its arguments.

For a signal named :post_created in MyApp.Signals, this is MyApp.Signals.PostCreated.

Nested DSLs

Examples

signal :post_created do
  argument :post_id, :uuid, allow_nil?: false
end

Arguments

NameTypeDefaultDocs
nameatomThe name of the signal.

Options

NameTypeDefaultDocs
phase:before_action | :after_action | :after_transaction:after_actionThe phase of the emitting action during which the signal may be emitted.
descriptionString.tA description of the signal.

signals.signal.argument

argument name, type

An argument of the signal, provided by the emitter.

Examples

argument :post_id, :uuid, allow_nil?: false

Arguments

NameTypeDefaultDocs
nameatomThe name of the field.
typemoduleThe type of the field.

Options

NameTypeDefaultDocs
constraintskeyword[]Constraints for the type.
allow_nil?booleantrueWhether the field may be nil.
defaultanyA default value for the field.
descriptionString.tA description of the field.

Introspection

Target: Ash.Signals.Field

Introspection

Target: Ash.Signals.Signal