Sha256: 3dbe05b96613d9f0cb6053db3399ec05a030779e8a0f71ff9b60878d8804cf79

Contents?: true

Size: 705 Bytes

Versions: 4

Compression:

Stored size: 705 Bytes

Contents

require 'did_you_mean/spell_checkers/name_error_checkers/class_name_checker'
require 'did_you_mean/spell_checkers/name_error_checkers/variable_name_checker'

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

    def self.new(exception)
      case exception.original_message
      when /uninitialized constant/
        ClassNameChecker
      when /undefined local variable or method/,
           /undefined method/,
           /uninitialized class variable/,
           /no member '.*' in struct/
        VariableNameChecker
      else
        NullChecker
      end.new(exception)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
did_you_mean-1.1.3 lib/did_you_mean/spell_checkers/name_error_checkers.rb
did_you_mean-1.1.2 lib/did_you_mean/spell_checkers/name_error_checkers.rb
ruby-compiler-0.1.1 vendor/ruby/gems/did_you_mean-1.1.0/lib/did_you_mean/spell_checkers/name_error_checkers.rb
did_you_mean-1.1.0 lib/did_you_mean/spell_checkers/name_error_checkers.rb