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.
This commit is contained in:
Yuki Nishijima 2015-02-06 11:52:41 -08:00
parent b9ba90d59e
commit ebe73abea0

@ -23,8 +23,7 @@ def missing_name
# # => true # # => true
def missing_name?(name) def missing_name?(name)
if name.is_a? Symbol if name.is_a? Symbol
last_name = (missing_name || '').split('::').last self.name == name
last_name == name.to_s
else else
missing_name == name.to_s missing_name == name.to_s
end end