lib/contrast/agent/assess/policy/propagator/trim.rb in contrast-agent-4.2.0 vs lib/contrast/agent/assess/policy/propagator/trim.rb in contrast-agent-4.3.0
- old
+ new
@@ -9,18 +9,16 @@
# This class is specifically for String#tr(_s) propagation
#
# Disclaimer: there may be a better way, but we're
# in a 'get it work' state. hopefully, we'll be in
# a 'get it right' state soon.
- class Trim
+ module Trim
class << self
def tr_tagger patcher, preshift, ret, _block
return ret unless ret && !ret.empty?
+ return ret unless (properties = Contrast::Agent::Assess::Tracker.properties!(ret))
- properties = Contrast::Agent::Assess::Tracker.properties(ret)
- return unless properties
-
source = preshift.object
args = preshift.args
properties.copy_from(source, ret)
replace_string = args[1]
source_chars = source.chars
@@ -57,12 +55,10 @@
ret
end
def tr_s_tagger patcher, preshift, ret, _block
return unless ret && !ret.empty?
-
- properties = Contrast::Agent::Assess::Tracker.properties(ret)
- return unless properties
+ return unless (properties = Contrast::Agent::Assess::Tracker.properties!(ret))
source = preshift.object
args = preshift.args
properties.splat_from(source, ret)
properties.build_event(