Class: Contrast::Agent::Assess::Policy::Propagator::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/assess/policy/propagator/base.rb,
ext/cs__assess_yield_track/cs__assess_yield_track.c

Overview

A propagator is a method which can transform data, as described by the Contrast::Agent::Assess::Policy::PropagationNode class. Each type of propagator does so differently, but always acts on a Source to pass tags from it to a Target.

Class Method Summary collapse

Class Method Details

.find_source(source, preshift) ⇒ Object

Retrieve the source from the preshift state.

Parameters:



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

def find_source source, preshift
  case source
  when Contrast::Utils::ObjectShare::OBJECT_KEY
    preshift.object
  else
    preshift.args[source]
  end
end

.propagate(_propagation_node, _preshift, _target) ⇒ Object

Propagate the tags from the source to the target. This method should be extended by the subclasses.

Raises:

  • (NoMethodError)

    This is being raised if any of the implementing subclasses does not have that method implemented, but is being called on.



40
41
42
# File 'lib/contrast/agent/assess/policy/propagator/base.rb', line 40

def propagate _propagation_node, _preshift, _target
  raise(NoMethodError("Expected Base propagator subclass: #{ cs__class } to implement #propagate"))
end

.tracked_value?(value) ⇒ Boolean

Check if tags are present on the given target.

Returns:

  • (Boolean)


31
32
33
# File 'lib/contrast/agent/assess/policy/propagator/base.rb', line 31

def tracked_value? value
  Contrast::Agent::Assess::Tracker.tracked?(value)
end