Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/appsignal/integrations/object.rb
Class Method Summary collapse
- .appsignal_instrument_class_method(method_name, options = {}) ⇒ Object
- .appsignal_instrument_method(method_name, options = {}) ⇒ Object
- .appsignal_reverse_class_name ⇒ Object private
Instance Method Summary collapse
Class Method Details
.appsignal_instrument_class_method(method_name, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/appsignal/integrations/object.rb', line 8 def self.appsignal_instrument_class_method(method_name, = {}) singleton_class.send \ :alias_method, "appsignal_uninstrumented_#{method_name}", method_name singleton_class.send(:define_method, method_name) do |*args, &block| name = .fetch(:name) do "#{method_name}.class_method.#{appsignal_reverse_class_name}.other" end Appsignal.instrument name do send "appsignal_uninstrumented_#{method_name}", *args, &block end end if singleton_class.respond_to?(:ruby2_keywords, true) # rubocop:disable Style/GuardClause singleton_class.send(:ruby2_keywords, method_name) end end |
.appsignal_instrument_method(method_name, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/appsignal/integrations/object.rb', line 27 def self.appsignal_instrument_method(method_name, = {}) alias_method "appsignal_uninstrumented_#{method_name}", method_name define_method method_name do |*args, &block| name = .fetch(:name) do "#{method_name}.#{appsignal_reverse_class_name}.other" end Appsignal.instrument name do send "appsignal_uninstrumented_#{method_name}", *args, &block end end ruby2_keywords method_name if respond_to?(:ruby2_keywords, true) end |
.appsignal_reverse_class_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 44 45 |
# File 'lib/appsignal/integrations/object.rb', line 41 def self.appsignal_reverse_class_name return "AnonymousClass" unless name name.split("::").reverse.join(".") end |
Instance Method Details
#appsignal_reverse_class_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 |
# File 'lib/appsignal/integrations/object.rb', line 48 def appsignal_reverse_class_name self.class.appsignal_reverse_class_name end |