Module: Contrast::Agent::Assess::Policy::Patcher
- Defined in:
- lib/contrast/agent/assess/policy/patcher.rb,
ext/cs__assess_module/cs__assess_module.c
Overview
This is how we patch into our customer’s code. It provides a way to track which classes we need to patch into and, once we’ve woven, provides a map for which methods our renamed functions need to call and how.
Class Method Summary collapse
-
.patch_assess_on_eval(mod) ⇒ Object
Some of the methods we care about, especially those used as dynamic sources, are truly dynamic, in that they do not exist on class load.
- .patcher ⇒ Object
- .policy ⇒ Object
Methods included from Components::Logger::InstanceMethods
Methods included from Components::Scope::InstanceMethods
contrast_enter_method_scopes!, contrast_exit_method_scopes!, with_app_scope, with_contrast_scope, with_deserialization_scope, with_split_scope
Class Method Details
.patch_assess_on_eval(mod) ⇒ Object
Some of the methods we care about, especially those used as dynamic sources, are truly dynamic, in that they do not exist on class load. These methods only exist once a module or class eval has been called. This hook is provided so that patches to those methods can pass us execution flow once a new method has been made available.
39 40 41 42 43 44 45 46 |
# File 'lib/contrast/agent/assess/policy/patcher.rb', line 39 def patch_assess_on_eval mod return unless ::Contrast::ASSESS.enabled? return if in_contrast_scope? patcher.patch_specific_module(mod) rescue StandardError => e logger.warn('Unable to patch assess during eval', e, module: mod.cs__name) end |