module Card::Set::Event::Api

Events are the building blocks of the three transformative card actions: create, update, and delete.

(The fourth kind of action, read, does not transform cards, and is associated with {Card::Format views}, not events).

As described in detail in {Card::Director}, each act can have many actions, each action has three phases, each phase has three stages, and each stage has many events.

Events are defined in set modules in {Cardio::Mod mods}. Learn more about {Cardio::Mod set modules}.

A simple event definition looks something like this:

event :append_you_know, :prepare_to_validate, on: :create do
  self.content = content + ", you know?"
end

Note:

Any card within the {Card::Set set} on which this event is defined will run this event during the ‘prepare_to_validate` stage when it is created.

Events should not be defined within format blocks.