1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Track RubyGems master(3.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20

This commit is contained in:
Hiroshi SHIBATA 2021-01-04 10:09:05 +09:00
parent 35c3a24c8c
commit 5537adf719
Notes: git 2021-01-04 13:15:11 +09:00
31 changed files with 257 additions and 216 deletions

View file

@ -0,0 +1,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