aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorYuki Nishijima <mail@yukinishijima.net>2015-02-06 11:52:41 -0800
committerYuki Nishijima <mail@yukinishijima.net>2015-02-07 00:14:04 -0800
commitebe73abea0ae02094ddc28f8fd60ae92373b6113 (patch)
tree23640f089bcbcd4115eae54b859770ef01f561a5 /activesupport
parentb9ba90d59ed28c28c07b04ecdc2035b471aea881 (diff)
downloadrails-ebe73abea0ae02094ddc28f8fd60ae92373b6113.tar.gz
rails-ebe73abea0ae02094ddc28f8fd60ae92373b6113.tar.bz2
rails-ebe73abea0ae02094ddc28f8fd60ae92373b6113.zip
NameError#missing_name? can jsut use NameError#name if the arg is a Symbol
NameError#name returns a missing name as a symbol, so if the given name is a symbol, it doesn't have to use #missing_name to get the last constant name in the error message.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/name_error.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/name_error.rb b/activesupport/lib/active_support/core_ext/name_error.rb
index b82148e4e5..6b447d772b 100644
--- a/activesupport/lib/active_support/core_ext/name_error.rb
+++ b/activesupport/lib/active_support/core_ext/name_error.rb
@@ -23,8 +23,7 @@ class NameError
# # => true
def missing_name?(name)
if name.is_a? Symbol
- last_name = (missing_name || '').split('::').last
- last_name == name.to_s
+ self.name == name
else
missing_name == name.to_s
end