Class: Contrast::Agent::Assess::Policy::Propagator::Splat
- Defined in:
- lib/contrast/agent/assess/policy/propagator/splat.rb
Overview
Propagation that results in all the tags of the source being applied to the totality of the target. The target’s preexisting tags are unaffected beyond any merging of overlapping tags.
Class Method Summary collapse
- .propagate(propagation_node, preshift, target) ⇒ Object
- .splat_tags(tracked_inputs, target) ⇒ Object
Methods inherited from Base
Class Method Details
.propagate(propagation_node, preshift, target) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/contrast/agent/assess/policy/propagator/splat.rb', line 14 def propagate propagation_node, preshift, target tracked_inputs = [] propagation_node.sources.each do |source| case source when Contrast::Utils::ObjectShare::OBJECT_KEY tracked_inputs << preshift.object if Contrast::Agent::Assess::Tracker.tracked?(preshift.object) else arg = preshift.args[source] if arg.is_a?(String) tracked_inputs << arg if Contrast::Agent::Assess::Tracker.tracked?(arg) elsif Contrast::Utils::DuckUtils.iterable_hash?(arg) arg.each_pair do |key, value| tracked_inputs << key if tracked_value?(key) tracked_inputs << value if tracked_value?(value) end elsif Contrast::Utils::DuckUtils.iterable_enumerable?(arg) arg.each do |value| tracked_inputs << value if tracked_value?(value) end end end end (tracked_inputs, target) Contrast::Agent::Assess::Tracker.properties(target). end |
.splat_tags(tracked_inputs, target) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/contrast/agent/assess/policy/propagator/splat.rb', line 42 def tracked_inputs, target return if tracked_inputs.empty? properties = Contrast::Agent::Assess::Tracker.properties(target) return unless properties tracked_inputs.each do |input| input_properties = Contrast::Agent::Assess::Tracker.properties(input) next unless input_properties properties.splat_from(input, target) end end |