diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-24 17:04:27 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-24 17:04:27 -0700 |
commit | 3f7130aed842bd077acb5bacab8f99a83ea0480b (patch) | |
tree | cd813fb87c04a30790cac821ffc51e853733cc84 /activesupport/lib | |
parent | 614fccd8c4bcd5b389c3265dcd9b5219555e2e48 (diff) | |
download | rails-3f7130aed842bd077acb5bacab8f99a83ea0480b.tar.gz rails-3f7130aed842bd077acb5bacab8f99a83ea0480b.tar.bz2 rails-3f7130aed842bd077acb5bacab8f99a83ea0480b.zip |
Document NameError extensions
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/name_error.rb | 7 |
1 files changed, 3 insertions, 4 deletions
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 |