1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
# frozen_string_literal: true
module TestProf
module EventProf
# Registers and activates custom events (which require patches).
module CustomEvents
class << self
def register(event, &block)
raise ArgumentError, "Block is required!" unless block_given?
registrations[event] = block
end
def activate_all(events)
events = events.split(",")
events.each { |event| try_activate(event) }
end
def try_activate(event)
return unless registrations.key?(event)
registrations.delete(event).call
end
private
def registrations
@registrations ||= {}
end
end
end
end
end
require "test_prof/event_prof/custom_events/factory_create"
require "test_prof/event_prof/custom_events/sidekiq_inline"
require "test_prof/event_prof/custom_events/sidekiq_jobs"
|