Class: Regexp

Inherits:
Object show all
Defined in:
lib/libaaron.rb

Instance Method Summary collapse

Instance Method Details

#multi_match(match_string) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/libaaron.rb', line 29

def multi_match(match_string)
  matches = Array.new
  while match = self.match(match_string)
    matches << match
    match_string = match.post_match
    yield match if block_given?
  end
  return matches
end

#multi_match_inside_wrapper(wrapper_pattern, string, &block) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/libaaron.rb', line 38

def multi_match_inside_wrapper(wrapper_pattern, string, &block)
  wrapper_pattern.multi_match(string) do |match|
    if block.nil?
      return self.multi_match(match[1])
    else
      self.multi_match(match[1], &block)
    end
  end
end