module Gemmy::Patches::StringPatch::InstanceMethods::RangeAll

Public Instance Methods

range_all(pattern, reuse=false) click to toggle source

facets like range patch but returns start/end indexes of all matches

# File lib/gemmy/patches/string_patch.rb, line 118
def range_all(pattern, reuse=false)
  r = []; i = 0
  while i < self.length
    rng = range(pattern, i)
    if rng
      r << rng
      i += reuse ? 1 : rng.end + 1
    else
      break
    end
  end
  r.uniq
end