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
-
.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
- .values_at_tagger(propagation_node, preshift, ret, _block) ⇒ Object
Methods inherited from Base
find_source, propagate, tracked_value?
Class Method Details
.captures_tagger(propagation_node, preshift, ret, _block) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 39 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.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 18 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
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 55 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
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/contrast/agent/assess/policy/propagator/match_data.rb', line 68 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 |