Module: Contrast::Framework::Rails::Patch::Support

Included in:
Support
Defined in:
lib/contrast/framework/rails/patch/support.rb

Overview

Extension point allowing for the registration of Patches required to support the Rails framework.

Instance Method Summary collapse

Instance Method Details

#after_load_patchesObject

(See BaseSupport#after_load_patches)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/contrast/framework/rails/patch/support.rb', line 27

def after_load_patches
  Set.new([
            Contrast::Agent::Patching::Policy::AfterLoadPatch.new(
                'ActionController::Live::Buffer',
                'contrast/framework/rails/patch/action_controller_live_buffer',
                instrumenting_module:
                  'Contrast::Framework::Rails::Patch::ActionControllerLiveBuffer'),
            Contrast::Agent::Patching::Policy::AfterLoadPatch.new(
                'Rails::Application::Configuration',
                'contrast/framework/rails/patch/rails_application_configuration',
                method_to_instrument: :session_store,
                instrumenting_module:
                  'Contrast::Framework::Rails::Patch::RailsApplicationConfiguration')
          ])
end

#before_load_patches!Object

(See BaseSupport#before_load_patches!)



15
16
17
18
19
20
21
22
23
24
# File 'lib/contrast/framework/rails/patch/support.rb', line 15

def before_load_patches!
  return unless defined?(::Rails)

  # In Rails, session configuration occurs extremely early & only once.
  # If we defer our patching of the rails session configuration too long
  # (i.e., where we normally patch) we will miss the configuration
  # and will never be able to report session misconfiguration rules.
  Contrast::Framework::Rails::Patch::RailsApplicationConfiguration.instrument
  require('contrast/framework/rails/railtie') if ::Rails::VERSION::MAJOR.to_i >= 3
end