Constants
No documentation available
No documentation available
Attributes
Read
No documentation available
Class Methods
lib/did_you_mean/spell_checkers/require_path_checker.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/did_you_mean/spell_checkers/require_path_checker.rb, line 25
def initialize(exception)
@path = exception.path
end
No documentation available
::
lib/did_you_mean/spell_checkers/require_path_checker.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/did_you_mean/spell_checkers/require_path_checker.rb, line 19
def self.requireables
@requireables ||= INITIAL_LOAD_PATH
.flat_map {|path| Dir.glob("**/???*{.rb,#{ENV_SPECIFIC_EXT}}", base: path) }
.map {|path| path.chomp!(".rb") || path.chomp!(ENV_SPECIFIC_EXT) }
end
No documentation available
Instance Methods
lib/did_you_mean/spell_checkers/require_path_checker.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/did_you_mean/spell_checkers/require_path_checker.rb, line 29
def corrections
@corrections ||= begin
threshold = path.size * 2
dictionary = self.class.requireables.reject {|str| str.size >= threshold }
spell_checker = path.include?("/") ? TreeSpellChecker : SpellChecker
spell_checker.new(dictionary: dictionary).correct(path).uniq
end
end
No documentation available