Class: Contrast::Agent::Assess::Policy::Propagator::Replace

Inherits:
Base
  • Object
show all
Defined in:
lib/contrast/agent/assess/policy/propagator/replace.rb

Overview

Propagation that results in all the tags of the source being applied to the target exactly as they are in the source. The target's preexisting tags are all removed.

Class Method Summary collapse

Methods inherited from Base

find_source, tracked_value?

Class Method Details

.propagate(propagation_node, preshift, target) ⇒ Object

Replace means we're replacing the target w/ the source. Anything on the source should be passed to the target.

propagation action required by this method.

Parameters:

  • the node responsible for the

  • pre call state of the things.

  • the object to which the source is being appended



21
22
23
24
25
26
27
# File 'lib/contrast/agent/assess/policy/propagator/replace.rb', line 21

def propagate propagation_node, preshift, target
  return unless (properties = Contrast::Agent::Assess::Tracker.properties!(target))

  source = find_source(propagation_node.sources[0], preshift)
  properties.clear_tags
  properties.copy_from(source, target, 0, propagation_node.untags)
end