Module: Card::Set::Event

Includes:
DelayedEvent
Included in:
Card::Set
Defined in:
lib/card/set/event.rb,
lib/card/set/event/delayed_event.rb

Overview

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 views, not events).

Whenever you create, update, or delete a card, the card goes through three phases:

  • validation makes sure all the data is in order
  • storage puts the data in the database
  • integration deals with any ramifications of those changes

Defined Under Namespace

Modules: DelayedEvent

Constant Summary

Constants included from DelayedEvent

DelayedEvent::DELAY_STAGES

Instance Method Summary collapse

Instance Method Details

#event(event, stage_or_opts = {}, opts = {}, &final) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/card/set/event.rb', line 14

def event event, stage_or_opts={}, opts={}, &final
  if stage_or_opts.is_a? Symbol
    opts[:in] = stage_or_opts
  else
    opts = stage_or_opts
  end
  process_stage_opts opts

  Card.define_callbacks event
  define_event event, opts, &final
  set_event_callbacks event, opts
end