Class: Contrast::Agent::Assess::Policy::Propagator::Substitution
- Extended by:
- SubstitutionUtils, Components::Logger::InstanceMethods
- Includes:
- Components::Logger::InstanceMethods
- Defined in:
- lib/contrast/agent/assess/policy/propagator/substitution.rb
Overview
This class is specifically for String#(g)sub propagation
Disclaimer: there may be a better way, but we’re in a ‘get it work’ state. hopefully, we’ll be in a ‘get it right’ state soon.
Constant Summary
Constants included from SubstitutionUtils
Contrast::Agent::Assess::Policy::Propagator::SubstitutionUtils::CAPTURE_GROUP_REGEXP, Contrast::Agent::Assess::Policy::Propagator::SubstitutionUtils::CAPTURE_NAME_REGEXP
Class Method Summary collapse
-
.gsub_tagger(patcher, preshift, ret, block) ⇒ Object
gsub is hard.
- .sub_tagger(patcher, preshift, ret, block) ⇒ Object
Methods included from Components::Logger::InstanceMethods
Class Method Details
.gsub_tagger(patcher, preshift, ret, block) ⇒ Object
gsub is hard. there are four versions of this method 1) pattern, replacement (my fav) 2) pattern, hash (not bad) 3) pattern, block (are you kidding me?) 4) pattern (plz no)
In addition, it requires things from $~ & $1-9, which are method scoped. Rather than fight that, we’ll call gsub from C land using a CUSTOM patch.
31 32 33 |
# File 'lib/contrast/agent/assess/policy/propagator/substitution.rb', line 31 def gsub_tagger patcher, preshift, ret, block substitution_tagger(patcher, preshift, ret, !block.nil?) end |
.sub_tagger(patcher, preshift, ret, block) ⇒ Object
35 36 37 |
# File 'lib/contrast/agent/assess/policy/propagator/substitution.rb', line 35 def sub_tagger patcher, preshift, ret, block substitution_tagger(patcher, preshift, ret, !block.nil?, global: false) end |