Class: String

Inherits:
Object show all
Defined in:
lib/contrast/agent/assess/policy/propagator/split.rb

Overview

Special class to handle String#split in 2.6 which, when given a block, propagates each split piece directly

Instance Method Summary collapse

Instance Method Details

#cs__patched_string_split_specialObject



216
# File 'lib/contrast/agent/assess/policy/propagator/split.rb', line 216

alias_method :cs__patched_string_split_special, :split

#split(*args, &block) ⇒ Object

override of the the standard split method to handle the 2.6 direct yield case.

Note: because this patch is applied before our standard propagation, this call wrapped in it. As such, any call here happens in scope, so there is no need to manage it on our own.



224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/contrast/agent/assess/policy/propagator/split.rb', line 224

def split *args, &block
  if block
    Contrast::Agent::Assess::Policy::Propagator::Split.begin_split(self, args)
    begin
      cs__patched_string_split_special(*args, &block)
    ensure
      Contrast::Agent::Assess::Policy::Propagator::Split.end_split
    end
  else
    cs__patched_string_split_special(*args, &block)
  end
end