Class: Contrast::Agent::Assess::Policy::Propagator::Select
- Defined in:
- lib/contrast/agent/assess/policy/propagator/select.rb
Overview
This class is specifically for String#select 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 Method Summary collapse
Class Method Details
.select_tagger(patcher, preshift, ret, _block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/contrast/agent/assess/policy/propagator/select.rb', line 20 def select_tagger patcher, preshift, ret, _block source = preshift.object args = preshift.args # 'gotcha' # Additionally, an empty string is returned when the starting index for # a character range is at the end of the string. Let's just skip that # and only track a string that has length return unless ret && !ret.empty? && Contrast::Agent::Assess::Tracker.tracked?(source) return unless (source_properties = Contrast::Agent::Assess::Tracker.properties(source)) return unless (properties = Contrast::Agent::Assess::Tracker.properties!(ret)) event_data = Contrast::Agent::Assess::Events::EventData.new(patcher, ret, source, ret, args) properties.build_event(event_data) range = determine_select_range(source, args) return unless range = source_properties.(range) properties. .each_pair do |key, value| properties.(key, value) end ret end |