1 # Add a +missing_name+ method to NameError instances.
2 class NameError
#:nodoc:
3 # Add a method to obtain the missing name from a NameError.
5 $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message
8 # Was this exception raised because the given name was missing?
9 def missing_name
?(name
)
11 last_name
= (missing_name
|| '').split('::').last
12 last_name
== name
.to_s
14 missing_name
== name
.to_s