123456789_123456789_123456789_123456789_123456789_

Class: Gem::UnknownCommandSpellChecker

Relationships & Source Files
Inherits: Object
Defined in: lib/rubygems/unknown_command_spell_checker.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(error) ⇒ UnknownCommandSpellChecker

[ GitHub ]

  
# File 'lib/rubygems/unknown_command_spell_checker.rb', line 6

def initialize(error)
  @error = error
end

Instance Attribute Details

#error (readonly)

[ GitHub ]

  
# File 'lib/rubygems/unknown_command_spell_checker.rb', line 4

attr_reader :error

Instance Method Details

#corrections

[ GitHub ]

  
# File 'lib/rubygems/unknown_command_spell_checker.rb', line 10

def corrections
  @corrections ||=
    spell_checker.correct(error.unknown_command).map(&:inspect)
end

#spell_checker (private)

[ GitHub ]

  
# File 'lib/rubygems/unknown_command_spell_checker.rb', line 17

def spell_checker
  dictionary = Gem::CommandManager.instance.command_names
  DidYouMean::SpellChecker.new(dictionary: dictionary)
end