lib/contrast/framework/rails/patch/support.rb in contrast-agent-4.12.0 vs lib/contrast/framework/rails/patch/support.rb in contrast-agent-4.13.0

- old
+ new

@@ -36,39 +36,41 @@ 'contrast/framework/rails/patch/rails_application_configuration', method_to_instrument: :session_store, instrumenting_module: 'Contrast::Framework::Rails::Patch::RailsApplicationConfiguration') ]) - if RUBY_VERSION < '2.6.0' - patches.merge([ - # TODO: RUBY-714 remove w/ EOL of 2.5 - # - # @deprecated Everything past here is used for Rewriting and can - # be removed once we no longer support 2.5. - Contrast::Agent::Patching::Policy::AfterLoadPatch.new( - 'ActionController::Railties::Helper::ClassMethods', - 'contrast/framework/rails/rewrite/action_controller_railties_helper_inherited', - method_to_instrument: :inherited, - instrumenting_module: - 'Contrast::Framework::Rails::Rewrite::ActionControllerRailtiesHelperInherited'), - Contrast::Agent::Patching::Policy::AfterLoadPatch.new( - 'ActiveRecord::AttributeMethods::Read::ClassMethods', - 'contrast/framework/rails/rewrite/active_record_attribute_methods_read', - instrumenting_module: - 'Contrast::Framework::Rails::Rewrite::ActiveRecordAttributeMethodsRead'), - Contrast::Agent::Patching::Policy::AfterLoadPatch.new( - 'ActiveRecord::Scoping::Named::ClassMethods', - 'contrast/framework/rails/rewrite/active_record_named', - instrumenting_module: 'Contrast::Framework::Rails::Rewrite::ActiveRecordNamed'), - Contrast::Agent::Patching::Policy::AfterLoadPatch.new( - 'ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods', - 'contrast/framework/rails/rewrite/active_record_time_zone_inherited', - method_to_instrument: :inherited, - instrumenting_module: - 'Contrast::Framework::Rails::Rewrite::ActiveRecordTimeZoneInherited') - ]) - end + patches.merge(special_after_load_patches) if RUBY_VERSION < '2.6.0' patches + end + + def special_after_load_patches + [ + # TODO: RUBY-714 remove w/ EOL of 2.5 + # + # @deprecated Everything past here is used for Rewriting and can + # be removed once we no longer support 2.5. + Contrast::Agent::Patching::Policy::AfterLoadPatch.new( + 'ActionController::Railties::Helper::ClassMethods', + 'contrast/framework/rails/rewrite/action_controller_railties_helper_inherited', + method_to_instrument: :inherited, + instrumenting_module: + 'Contrast::Framework::Rails::Rewrite::ActionControllerRailtiesHelperInherited'), + Contrast::Agent::Patching::Policy::AfterLoadPatch.new( + 'ActiveRecord::AttributeMethods::Read::ClassMethods', + 'contrast/framework/rails/rewrite/active_record_attribute_methods_read', + instrumenting_module: + 'Contrast::Framework::Rails::Rewrite::ActiveRecordAttributeMethodsRead'), + Contrast::Agent::Patching::Policy::AfterLoadPatch.new( + 'ActiveRecord::Scoping::Named::ClassMethods', + 'contrast/framework/rails/rewrite/active_record_named', + instrumenting_module: 'Contrast::Framework::Rails::Rewrite::ActiveRecordNamed'), + Contrast::Agent::Patching::Policy::AfterLoadPatch.new( + 'ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods', + 'contrast/framework/rails/rewrite/active_record_time_zone_inherited', + method_to_instrument: :inherited, + instrumenting_module: + 'Contrast::Framework::Rails::Rewrite::ActiveRecordTimeZoneInherited') + ] end end end end end