Class: DidYouMean::ClassNameChecker
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: | Object |
Defined in: | lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb |
Class Method Summary
- .new(exception) ⇒ ClassNameChecker constructor
Instance Attribute Summary
- #class_name readonly
Instance Method Summary
Constructor Details
.new(exception) ⇒ ClassNameChecker
# File 'lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb', line 9
def initialize(exception) @class_name, @receiver, @original_message = exception.name, exception.receiver, exception. end
Instance Attribute Details
#class_name (readonly)
[ GitHub ]# File 'lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb', line 7
attr_reader :class_name
Instance Method Details
#class_names
[ GitHub ]#corrections
[ GitHub ]# File 'lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb', line 13
def corrections @corrections ||= SpellChecker.new(dictionary: class_names) .correct(class_name) .map(&:full_name) .reject {|qualified_name| @original_message.include?(qualified_name) } end
#scopes
[ GitHub ]# File 'lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb', line 28
def scopes @scopes ||= @receiver.to_s.split("::").inject([Object]) do |_scopes, scope| _scopes << _scopes.last.const_get(scope) end.uniq end