lib/appsignal/hooks.rb in appsignal-2.1.0.alpha.3 vs lib/appsignal/hooks.rb in appsignal-2.1.0.beta.1

- old
+ new

@@ -15,11 +15,11 @@ @hooks ||= {} end end class Hook - def self.register(name, hook=self) + def self.register(name, hook = self) Appsignal::Hooks.register(name, hook.new) end def initialize @installed = false @@ -61,20 +61,22 @@ def truncate(text) text.size > 200 ? "#{text[0...197]}..." : text end - def extract_value(object_or_hash, field, default_value=nil, convert_to_s=false) - value = if object_or_hash.respond_to?(:[]) - begin - object_or_hash[field] - rescue NameError - nil - end - elsif object_or_hash.respond_to?(field) - object_or_hash.send(field) - end || default_value + def extract_value(object_or_hash, field, default_value = nil, convert_to_s = false) + value = + if object_or_hash.respond_to?(:[]) + begin + object_or_hash[field] + rescue NameError + nil + end + elsif object_or_hash.respond_to?(field) + object_or_hash.send(field) + end || default_value + if convert_to_s value.to_s else value end @@ -87,20 +89,20 @@ end end end end -require 'appsignal/hooks/active_support_notifications' -require 'appsignal/hooks/celluloid' -require 'appsignal/hooks/delayed_job' -require 'appsignal/hooks/net_http' -require 'appsignal/hooks/passenger' -require 'appsignal/hooks/puma' -require 'appsignal/hooks/rake' -require 'appsignal/hooks/redis' -require 'appsignal/hooks/sequel' -require 'appsignal/hooks/shoryuken' -require 'appsignal/hooks/sidekiq' -require 'appsignal/hooks/unicorn' -require 'appsignal/hooks/mongo_ruby_driver' -require 'appsignal/hooks/webmachine' -require 'appsignal/hooks/data_mapper' +require "appsignal/hooks/active_support_notifications" +require "appsignal/hooks/celluloid" +require "appsignal/hooks/delayed_job" +require "appsignal/hooks/net_http" +require "appsignal/hooks/passenger" +require "appsignal/hooks/puma" +require "appsignal/hooks/rake" +require "appsignal/hooks/redis" +require "appsignal/hooks/sequel" +require "appsignal/hooks/shoryuken" +require "appsignal/hooks/sidekiq" +require "appsignal/hooks/unicorn" +require "appsignal/hooks/mongo_ruby_driver" +require "appsignal/hooks/webmachine" +require "appsignal/hooks/data_mapper"