Module: Card::Director::EventDelay
- Included in:
- ClassMethods
- Defined in:
- lib/card/director/event_delay.rb
Overview
methods for handling delayed events
Instance Method Summary collapse
-
#contextualize_delayed_event(act_id, card, env, auth, &block) ⇒ Object
If active jobs (and hence the integrate_with_delay events) don’t run in a background process then Card::Env.deserialize! decouples the controller’s params hash and the Card::Env’s params hash with the effect that params changes in the CardController get lost (a crucial example are success params that are processed in CardController#soft_redirect).
- #delaying? ⇒ Boolean
- #run_job_with_act(act, card, &block) ⇒ Object
- #with_delay_act(act_id, card, &block) ⇒ Object
- #with_env_and_auth(env, auth, &block) ⇒ Object
Instance Method Details
#contextualize_delayed_event(act_id, card, env, auth, &block) ⇒ Object
If active jobs (and hence the integrate_with_delay events) don’t run in a background process then Card::Env.deserialize! decouples the controller’s params hash and the Card::Env’s params hash with the effect that params changes in the CardController get lost (a crucial example are success params that are processed in CardController#soft_redirect)
11 12 13 14 15 16 17 |
# File 'lib/card/director/event_delay.rb', line 11 def contextualize_delayed_event act_id, card, env, auth, &block return yield unless with_env_and_auth env, auth do with_delay_act(act_id, card, &block) end end |
#delaying? ⇒ Boolean
19 20 21 |
# File 'lib/card/director/event_delay.rb', line 19 def Cardio.config. == true end |
#run_job_with_act(act, card, &block) ⇒ Object
29 30 31 32 33 |
# File 'lib/card/director/event_delay.rb', line 29 def run_job_with_act act, card, &block run_act card do act_card.director.run_delayed_event act, &block end end |
#with_delay_act(act_id, card, &block) ⇒ Object
23 24 25 26 27 |
# File 'lib/card/director/event_delay.rb', line 23 def with_delay_act act_id, card, &block return yield unless act_id && (self.act = Act.find act_id) run_job_with_act act, card, &block end |