Module: Gemmy::Patches::StringPatch::InstanceMethods::EachMatch

Defined in:
lib/gemmy/patches/string_patch.rb

Instance Method Summary collapse

Instance Method Details

#each_match(re) ⇒ Object

facets iterator over matches from regex



143
144
145
146
147
148
149
150
151
# File 'lib/gemmy/patches/string_patch.rb', line 143

def each_match(re) #:yield:
  if block_given?
    scan(re) { yield($~) }
  else
    m = []
    scan(re) { m << $~ }
    m
  end
end