Module: DidYouMean::NameErrorFinders

Defined in:
lib/did_you_mean/finders/name_error_finders.rb

Class Method Summary collapse

Class Method Details

.includedObject



3
4
5
# File 'lib/did_you_mean/finders/name_error_finders.rb', line 3

def self.included(*)
  raise "Do not include this module since it overrides Class.new method."
end

.new(exception) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/did_you_mean/finders/name_error_finders.rb', line 7

def self.new(exception)
  case exception.original_message
  when /uninitialized constant/
    ClassFinder
  when /undefined local variable or method/, /undefined method/, /uninitialized class variable/
    NameFinder
  else
    NullFinder
  end.new(exception)
end