Sha256: c9af4098e3a65f36ab5b97f58b0a5bc9eb311613fa13d9c1cedec33b2dcf4d24
Contents?: true
Size: 1.33 KB
Versions: 15
Compression:
Stored size: 1.33 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 in reverse of how they are in the source. The # target's preexisting tags are unaffected beyond any merging of # overlapping tags. class Reverse < Contrast::Agent::Assess::Policy::Propagator::Base class << self def propagate propagation_node, preshift, target source = find_source(propagation_node.sources[0], preshift) target.cs__copy_from(source, 0, propagation_node.untags) length = target.length target.cs__properties.tag_keys.each do |key| tags = target.cs__properties.fetch_tag(key) tags.each do |tag| new_end = length - tag.start_idx new_start = new_end - tag.length tag.repurpose(new_start, new_end) end end target.cs__properties.cleanup_tags end end end end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems