Sha256: bf1d410fd4b12d6a40a2160005b92b9ab22e402940be0f853fec92b39fed4ef3

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

module Contrast
  module Agent
    module Assess
      module Policy
        module Propagator
          # 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 Replace < Contrast::Agent::Assess::Policy::Propagator::Base
            class << self
              # Replace means we're replacing the target w/ the source. Anything
              # on the source should be passed to the target.
              def propagate propagation_node, preshift, target
                properties = Contrast::Agent::Assess::Tracker.properties(target)
                return unless properties

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contrast-agent-4.2.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.1.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.0.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-3.16.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-3.15.0 lib/contrast/agent/assess/policy/propagator/replace.rb