Module: Contrast::Agent::Assess::Policy::RewriterPatch Deprecated
- Includes:
- Components::Interface
- Defined in:
- lib/contrast/agent/assess/policy/rewriter_patch.rb
Overview
Deprecated.
Changes to this class are discouraged as this approach is being phased out with support for those language versions.
This is our interface from the Patcher to the Rewriter functionality
TODO: RUBY-714 remove w/ EOL of 2.5
Class Method Summary collapse
Methods included from Components::Interface
Class Method Details
.rewrite_interpolation(mod, redo_rewrite = false) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/contrast/agent/assess/policy/rewriter_patch.rb', line 35 def rewrite_interpolation mod, redo_rewrite = false return unless should_rewrite?(mod) status = Contrast::Agent::Patching::Policy::PatchStatus.get_status(mod) return if (status&.rewritten? || status&.rewriting?) && !redo_rewrite module_name = mod.cs__name return unless module_name if module_name.start_with?(Contrast::Utils::ObjectShare::CONTRAST_MODULE_START, Contrast::Utils::ObjectShare::ANONYMOUS_CLASS_MARKER) status.no_rewrite! return end module_data = Contrast::Agent::ModuleData.new(mod, module_name) logger.trace_with_time('Rewriting module', module: module_name) do Contrast::Agent::Rewriter.rewrite_class(module_data, redo_rewrite) end rescue StandardError => e logger.error('Unable to patch for assess', e, module: mod) end |
.rewrite_interpolations ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/contrast/agent/assess/policy/rewriter_patch.rb', line 25 def rewrite_interpolations return unless agent_should_rewrite? logger.debug_with_time('Running Assess interpolation rewrite') do ObjectSpace.each_object(Module) do |mod| rewrite_interpolation(mod) end end end |