Exception: Gem::UnknownCommandError

Inherits:
Exception
  • Object
show all
Defined in:
lib/rubygems/exceptions.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(unknown_command) ⇒ UnknownCommandError

Returns a new instance of UnknownCommandError.



16
17
18
19
20
21
# File 'lib/rubygems/exceptions.rb', line 16

def initialize(unknown_command)
  self.class.attach_correctable

  @unknown_command = unknown_command
  super("Unknown command #{unknown_command}")
end

Instance Attribute Details

#unknown_commandObject (readonly)

Returns the value of attribute unknown_command.



14
15
16
# File 'lib/rubygems/exceptions.rb', line 14

def unknown_command
  @unknown_command
end

Class Method Details

.attach_correctableObject



23
24
25
26
27
28
29
# File 'lib/rubygems/exceptions.rb', line 23

def self.attach_correctable
  return if method_defined?(:corrections)

  if defined?(DidYouMean) && DidYouMean.respond_to?(:correct_error)
    DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker)
  end
end