From 3f7130aed842bd077acb5bacab8f99a83ea0480b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 24 Mar 2009 17:04:27 -0700 Subject: Document NameError extensions --- activesupport/lib/active_support/core_ext/name_error.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/name_error.rb') diff --git a/activesupport/lib/active_support/core_ext/name_error.rb b/activesupport/lib/active_support/core_ext/name_error.rb index 49176c12d9..cd165626c8 100644 --- a/activesupport/lib/active_support/core_ext/name_error.rb +++ b/activesupport/lib/active_support/core_ext/name_error.rb @@ -1,10 +1,9 @@ -# Add a +missing_name+ method to NameError instances. -class NameError #:nodoc: - # Add a method to obtain the missing name from a NameError. +class NameError + # Extract the name of the missing constant from the exception message. def missing_name $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message end - + # Was this exception raised because the given name was missing? def missing_name?(name) if name.is_a? Symbol -- cgit v1.2.3