class Card::Set::Event
Supports the definition of events via the {Api Events API}
Constants
- CONDITIONS
Attributes
Public Class Methods
Source
# File lib/card/set/event.rb, line 85 def initialize event, set_module @event = event @set_module = set_module end
Public Instance Methods
Source
# File lib/card/set/event.rb, line 97 def define Card.define_callbacks @event define_event set_event_callbacks end
Source
# File lib/card/set/event.rb, line 120 def delaying_method_name "#{@event}_with_delay" end
the name for the method that adds the event to the delayed job queue
Source
# File lib/card/set/event.rb, line 104 def name @event end
@return the name of the event
Source
# File lib/card/set/event.rb, line 90 def register stage_or_opts, opts, &final @opts = event_opts stage_or_opts, opts @event_block = final validate_conditions define end
Source
# File lib/card/set/event.rb, line 114 def simple_method_name "#{@event}_without_callbacks" end
the name for the method that only executes the code defined in the event
Private Instance Methods
Source
# File lib/card/set/event.rb, line 128 def define_event define_simple_method define_event_method end
EVENT DEFINITION
Source
# File lib/card/set/event.rb, line 139 def define_event_method send "define_#{event_type}_event_method" end
Source
# File lib/card/set/event.rb, line 133 def define_simple_method @set_module.class_exec(self) do |event| define_method event.simple_method_name, &event.block end end
Source
# File lib/card/set/event.rb, line 147 def define_standard_event_method method_name=simple_method_name is_integration = @stage.to_s.match?(/integrate/) @set_module.class_exec(@event) do |event_name| define_method event_name do rescuing_if_integration is_integration do log_event_call event_name run_callbacks event_name do send method_name end end end end end
Source
# File lib/card/set/event.rb, line 143 def event_type with_delay?(@opts) ? :delayed : :standard end