lib/contrast/agent/assess/policy/propagator/trim.rb in contrast-agent-4.6.0 vs lib/contrast/agent/assess/policy/propagator/trim.rb in contrast-agent-4.7.0
- old
+ new
@@ -10,11 +10,10 @@
#
# 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.
module Trim
class << self
-
# @param policy_node [Contrast::Agent::Assess::Policy::PropagationNode] the node that governs this
# propagation event.
# @param preshift [Contrast::Agent::Assess::PreShift] The capture of the state of the code just prior to
# the invocation of the patched method.
# @param ret [nil, String] the target to which to propagate.
@@ -24,33 +23,22 @@
return ret unless (properties = Contrast::Agent::Assess::Tracker.properties!(ret))
properties.copy_from(preshift.object, ret)
handle_tr(policy_node, preshift, ret, properties)
- properties.build_event(
- policy_node,
- ret,
- preshift.object,
- ret,
- preshift.args,
- 1)
+ properties.build_event(policy_node, ret, preshift.object, ret, preshift.args, 1)
ret
end
def tr_s_tagger patcher, preshift, ret, _block
return unless ret && !ret.empty?
return unless (properties = Contrast::Agent::Assess::Tracker.properties!(ret))
source = preshift.object
args = preshift.args
properties.splat_from(source, ret)
- properties.build_event(
- patcher,
- ret,
- source,
- ret,
- args)
+ properties.build_event(patcher, ret, source, ret, args)
ret
end
private
@@ -70,10 +58,10 @@
Contrast::Agent::Assess::Policy::Propagator::Remove.handle_removal(policy_node, source, ret)
return
end
# Otherwise, we need to target each insertion point. Based on the spec for #tr & #tr_s, the find is
- # treated as a regex range, excepting the `\` character, which we'll need to escape. This converts to
+ # treated as a regexp range, excepting the `\` character, which we'll need to escape. This converts to
# that form, wrapping the input in `[]`.
find_string = preshift.args[0]
find_string += '\\' if find_string.end_with?('\\')
find_regexp = Regexp.new("[#{ find_string }]")