Sha256: 8d7806e95e1cb6f1a670a858fe0c7090608fb209bad49e652e21721bbff922d9

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

# Copyright (c) 2021 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
                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
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
contrast-agent-4.14.1 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.14.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.13.1 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.13.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.12.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.11.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.10.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.9.1 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.9.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.8.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.7.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.6.0 lib/contrast/agent/assess/policy/propagator/replace.rb
contrast-agent-4.5.0 lib/contrast/agent/assess/policy/propagator/replace.rb