Module: Contrast::Agent::Assess::Property::Updated
- Included in:
- Contrast::Agent::Assess::Properties
- Defined in:
- lib/contrast/agent/assess/property/updated.rb
Overview
This module serves to hold the functionality required for the update of properties as they go through dataflow.
Instance Method Summary collapse
-
#copy_from(source, owner, shift = 0, skip_tags = nil) ⇒ Object
copy tags and info from source’s properties to self.
-
#splat_from(source, owner) ⇒ Object
Some propagation occurred, but we’re not sure what the exact transformation was.
Instance Method Details
#copy_from(source, owner, shift = 0, skip_tags = nil) ⇒ Object
copy tags and info from source’s properties to self
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/property/updated.rb', line 21 def copy_from source, owner, shift = 0, = nil return if owner.equal?(source) return unless Contrast::Agent::Assess::Tracker.tracked?(source) original = Contrast::Agent::Assess::Tracker.properties(source) return unless original adjust_duplicate(original) original.tag_keys.each do |key| next if &.include?(key) existing = [key] had_existing = existing.any? value = original.fetch_tag(key) value.each do |tag| existing << tag.copy_modified(shift) end Contrast::Utils::TagUtil.size_aware_merge(owner, existing) if had_existing end end |
#splat_from(source, owner) ⇒ Object
Some propagation occurred, but we’re not sure what the exact transformation was. To be safe, we just explode all the tags from the source to the return.
If the return already had that tag, the existing tag range is recycled to save us an object.
52 53 54 55 56 57 58 59 |
# File 'lib/contrast/agent/assess/property/updated.rb', line 52 def splat_from source, owner splat_length = Contrast::Utils::StringUtils.ret_length(owner) return if splat_length.zero? splat_from_ret(splat_length) splat_from_source(source, splat_length) end |