blob: ee5c2fbe04706d1a1d92e7378f115d10deb2c6fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# frozen_string_literal: true
class Gem::UnknownCommandSpellChecker
attr_reader :error
def initialize(error)
@error = error
end
def corrections
@corrections ||=
spell_checker.correct(error.unknown_command).map(&:inspect)
end
private
def spell_checker
dictionary = Gem::CommandManager.instance.command_names
DidYouMean::SpellChecker.new(dictionary: dictionary)
end
end
|