aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/name_error.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-03-24 17:04:27 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-03-24 17:04:27 -0700
commit3f7130aed842bd077acb5bacab8f99a83ea0480b (patch)
treecd813fb87c04a30790cac821ffc51e853733cc84 /activesupport/lib/active_support/core_ext/name_error.rb
parent614fccd8c4bcd5b389c3265dcd9b5219555e2e48 (diff)
downloadrails-3f7130aed842bd077acb5bacab8f99a83ea0480b.tar.gz
rails-3f7130aed842bd077acb5bacab8f99a83ea0480b.tar.bz2
rails-3f7130aed842bd077acb5bacab8f99a83ea0480b.zip
Document NameError extensions
Diffstat (limited to 'activesupport/lib/active_support/core_ext/name_error.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/name_error.rb7
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