Module: Card::Set::Event
- Included in:
- Card::Set
- Defined in:
- lib/card/set/event.rb
Instance Method Summary collapse
- #define_event(event, opts, &final) ⇒ Object
- #event(event, stage_or_opts = {}, opts = {}, &final) ⇒ Object
Instance Method Details
#define_event(event, opts, &final) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/card/set/event.rb', line 17 def define_event event, opts, &final final_method_name = "#{event}_without_callbacks" # should be private? class_eval do define_method final_method_name, &final end if with_delay? opts = "#{event}_with_delay" event, define_event_method event, , opts define_active_job event, final_method_name, opts[:queue_as] else define_event_method event, final_method_name, opts end end |
#event(event, stage_or_opts = {}, opts = {}, &final) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/card/set/event.rb', line 4 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 |