Class: Contrast::Agent::Assess::Policy::Propagator::MatchData
- Defined in:
- lib/contrast/agent/assess/policy/propagator/match_data.rb
Overview
Propagation that results in all the tags of the source being applied to the target exactly as is. The target’s preexisting tags are unaffected beyond any merging of overlapping tags.
Class Method Summary collapse
-
.captures_tagger(propagation_node, preshift, ret, _block) ⇒ Object
Captures is a method that returns an array of MatchData objects.
-
.square_bracket_tagger(propagation_node, preshift, ret, _block) ⇒ Object
This patch method is used to track through the MatchData#[] and MatchData#match methods, since the last was introduced after Ruby 3.1.0, but shares similar functionality, except it does not support ranges.
-
.to_a_tagger(propagation_node, preshift, ret, _block) ⇒ Object
propagation action required by this method.
-
.values_at_tagger(propagation_node, preshift, ret, _block) ⇒ Object
propagation action required by this method.
Methods inherited from Base
find_source, propagate, tracked_value?
Class Method Details
.captures_tagger(propagation_node, preshift, ret, _block) ⇒ Object
Captures is a method that returns an array of MatchData objects.
propagation action required by this method.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 54 def captures_tagger propagation_node, preshift, ret, _block return unless ret idx = 0 while idx < ret.length return_value = ret[idx] index = idx idx += 1 next unless return_value targetted_index = index + 1 square_bracket_single(targetted_index, preshift, return_value, propagation_node) end ret end |
.square_bracket_tagger(propagation_node, preshift, ret, _block) ⇒ Object
This patch method is used to track through the MatchData#[] and MatchData#match methods, since the last was introduced after Ruby 3.1.0, but shares similar functionality, except it does not support ranges.
propagation action required by this method.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 25 def square_bracket_tagger propagation_node, preshift, ret, _block case ret when Array idx = 0 while idx < ret.length return_value = ret[idx] index = idx idx += 1 next unless return_value square_bracket_single(target_matchdata_index(preshift, index), preshift, return_value, propagation_node) end when String target_matchdata_index = preshift.args[0] square_bracket_single(target_matchdata_index, preshift, ret, propagation_node) end ret end |
.to_a_tagger(propagation_node, preshift, ret, _block) ⇒ Object
propagation action required by this method.
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 76 def to_a_tagger propagation_node, preshift, ret, _block idx = 0 while idx < ret.length return_value = ret[idx] index = idx idx += 1 next unless return_value square_bracket_single(index, preshift, return_value, propagation_node) end ret end |
.values_at_tagger(propagation_node, preshift, ret, _block) ⇒ Object
propagation action required by this method.
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 95 def values_at_tagger propagation_node, preshift, ret, _block idx = 0 while idx < ret.length return_value = ret[idx] return_index = idx idx += 1 next unless return_value original_group_arg_index = preshift.args[return_index] square_bracket_single(original_group_arg_index, preshift, return_value, propagation_node) end ret end |