diff options
Diffstat (limited to 'activesupport/lib/active_support/notifications')
-rw-r--r-- | activesupport/lib/active_support/notifications/fanout.rb | 8 | ||||
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb index c53f9c1039..25aab175b4 100644 --- a/activesupport/lib/active_support/notifications/fanout.rb +++ b/activesupport/lib/active_support/notifications/fanout.rb @@ -1,5 +1,7 @@ -require 'mutex_m' -require 'concurrent/map' +# frozen_string_literal: true + +require "mutex_m" +require "concurrent/map" module ActiveSupport module Notifications @@ -68,7 +70,7 @@ module ActiveSupport module Subscribers # :nodoc: def self.new(pattern, listener) - if listener.respond_to?(:start) and listener.respond_to?(:finish) + if listener.respond_to?(:start) && listener.respond_to?(:finish) subscriber = Evented.new pattern, listener else subscriber = Timed.new pattern, listener diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 91f94cb2d7..e99f5ee688 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -1,4 +1,6 @@ -require 'securerandom' +# frozen_string_literal: true + +require "securerandom" module ActiveSupport module Notifications @@ -14,7 +16,7 @@ module ActiveSupport # Instrument the given block by measuring the time taken to execute it # and publish it. Notice that events get sent even if an error occurs # in the passed-in block. - def instrument(name, payload={}) + def instrument(name, payload = {}) # some of the listeners might have state listeners_state = start name, payload begin @@ -44,9 +46,9 @@ module ActiveSupport private - def unique_id - SecureRandom.hex(10) - end + def unique_id + SecureRandom.hex(10) + end end class Event |