Skip to content

Instantly share code, notes, and snippets.

@josevalim
Created January 6, 2010 18:23
Show Gist options
  • Select an option

  • Save josevalim/270495 to your computer and use it in GitHub Desktop.

Select an option

Save josevalim/270495 to your computer and use it in GitHub Desktop.
module ActiveSupport
module Notifications
autoload :Instrumenter, 'active_support/notifications/instrumenter'
autoload :Event, 'active_support/notifications/instrumenter'
autoload :Fanout, 'active_support/notifications/fanout'
class << self
attr_writer :notifier
delegate :publish, :subscribe, :to => :notifier
delegate :instrument, :to => :instrumenter
def notifier
@notifier ||= Notifier.new
end
def instrumenter
Thread.current[:"instrumentation_#{notifier.object_id}"] ||= Instrumenter.new(notifier)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment