Class NameError
In: vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
Parent: StandardError

Add a missing_name method to NameError instances.

Methods

Public Instance methods

Add a method to obtain the missing name from a NameError.

[Source]

   # File vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb, line 6
6:   def missing_name
7:     $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message
8:   end

Was this exception raised because the given name was missing?

[Source]

    # File vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb, line 11
11:   def missing_name?(name)
12:     if name.is_a? Symbol
13:       last_name = (missing_name || '').split('::').last
14:       last_name == name.to_s
15:     else
16:       missing_name == name.to_s
17:     end
18:   end

[Validate]