lib/nunes/subscriber.rb in nunes-0.4.0 vs lib/nunes/subscriber.rb in nunes-0.5.0

- old
+ new

@@ -1,12 +1,15 @@ require "active_support/notifications" module Nunes class Subscriber # Private: The bang character that is the first char of some events. - BANG = '!' + BANG = "!".freeze + # Private: The dot charactor used to determine the method name. + DOT = ".".freeze + # Public: Setup a subscription for the subscriber using the # provided adapter. # # adapter - The adapter instance to send instrumentation to. def self.subscribe(adapter, options = {}) @@ -32,10 +35,10 @@ def call(name, start, ending, transaction_id, payload) # rails doesn't recommend instrumenting methods that start with bang # when in production return if name.start_with?(BANG) - method_name = name.split('.').first + method_name = name.split(DOT).first if respond_to?(method_name) send(method_name, start, ending, transaction_id, payload) end end