Module: TestProf::EventProf::CustomEvents

Defined in:
lib/test_prof/event_prof/custom_events.rb,
lib/test_prof/event_prof/custom_events/sidekiq_jobs.rb,
lib/test_prof/event_prof/custom_events/factory_create.rb,
lib/test_prof/event_prof/custom_events/sidekiq_inline.rb

Overview

Registers and activates custom events (which require patches).

Defined Under Namespace

Modules: FactoryCreate, SidekiqInline, SidekiqJobs

Class Method Summary collapse

Class Method Details

.activate_all(events) ⇒ Object



13
14
15
16
# File 'lib/test_prof/event_prof/custom_events.rb', line 13

def activate_all(events)
  events = events.split(",")
  events.each { |event| try_activate(event) }
end

.register(event) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
# File 'lib/test_prof/event_prof/custom_events.rb', line 8

def register(event)
  raise ArgumentError, "Block is required!" unless block_given?
  registrations[event] = Proc.new
end

.try_activate(event) ⇒ Object



18
19
20
21
# File 'lib/test_prof/event_prof/custom_events.rb', line 18

def try_activate(event)
  return unless registrations.key?(event)
  registrations.delete(event).call
end