Class: Contrast::Agent::Assess::Policy::Propagator::Reverse
- Defined in:
- lib/contrast/agent/assess/policy/propagator/reverse.rb
Overview
Propagation that results in all the tags of the source being applied to the target in reverse of how they are in the source. The target’s preexisting tags are unaffected beyond any merging of overlapping tags.
Class Method Summary collapse
-
.propagate(propagation_node, preshift, target) ⇒ Object
propagation action required by this method.
Methods inherited from Base
Class Method Details
.propagate(propagation_node, preshift, target) ⇒ Object
propagation action required by this method.
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/reverse.rb', line 20 def propagate propagation_node, preshift, target return unless (properties = Contrast::Agent::Assess::Tracker.properties!(target)) source = find_source(propagation_node.sources[0], preshift) properties.copy_from(source, target, 0, propagation_node.) length = target.length properties.tag_keys.each do |key| = properties.fetch_tag(key) .each do |tag| new_end = length - tag.start_idx new_start = new_end - tag.length tag.repurpose(new_start, new_end) end end properties. end |