module TestProf::EventProf::CustomEvents

Registers and activates custom events (which require patches).

Public Class Methods

activate_all(events) click to toggle source
# 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, &block) click to toggle source
# File lib/test_prof/event_prof/custom_events.rb, line 8
def register(event, &block)
  raise ArgumentError, "Block is required!" unless block
  registrations[event] = block
end
try_activate(event) click to toggle source
# 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

Private Class Methods

registrations() click to toggle source
# File lib/test_prof/event_prof/custom_events.rb, line 25
def registrations
  @registrations ||= {}
end