Class: VerboseRegexp

Inherits:
Regexp show all
Defined in:
lib/regexp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Regexp

ROMAN, ROMAN_PATTERN, #interpolate, #interpolate_roman

Instance Attribute Details

#kObject

Returns the value of attribute k.



40
41
42
# File 'lib/regexp.rb', line 40

def k
  @k
end

#result_procObject

Returns the value of attribute result_proc.



41
42
43
# File 'lib/regexp.rb', line 41

def result_proc
  @result_proc
end

Instance Method Details

#match(*a) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/regexp.rb', line 43

def match(*a)
  m = super
  s = "MatchData breakdown for #{@k}: " 
  if m
    s += "\n" + m.display_breakdown
  else
    s += 'no match'
  end
  @result_proc.call :match, s
  m
end