lib/plain_apm/agent.rb in plain_apm-0.8.6 vs lib/plain_apm/agent.rb in plain_apm-0.8.7

- old
+ new

@@ -46,10 +46,12 @@ end def stop return if @publisher.nil? + uninstall_hooks + @events << nil @publisher.join @publisher = nil end @@ -58,20 +60,28 @@ def configure @config = Config.new end def install_hooks - [ + hooks.each(&:install) + end + + def uninstall_hooks + hooks.each(&:uninstall) + end + + def hooks + @hooks ||= [ Hooks::Deploy, Hooks::ActionMailer, Hooks::ActionPack, Hooks::ActionView, Hooks::ActiveJob, Hooks::ActiveRecord, Hooks::ActiveSupport, Hooks::ErrorReporter, Hooks::Manual - ].map(&:new).each(&:install) + ].map(&:new) end ## # Run a background thread that pops events from the queue and posts them to # the target server.