123456789_123456789_123456789_123456789_123456789_

Exception: Gem::UnknownCommandError

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Exception, RuntimeError
Instance Chain:
self, Exception, RuntimeError
Inherits: Gem::Exception
Defined in: lib/rubygems/exceptions.rb

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(unknown_command) ⇒ UnknownCommandError

[ GitHub ]

  
# 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

Class Method Details

.attach_correctable

[ GitHub ]

  
# File 'lib/rubygems/exceptions.rb', line 23

def self.attach_correctable
  return if defined?(@attached)

  if defined?(DidYouMean::SPELL_CHECKERS) && defined?(DidYouMean::Correctable)
    if DidYouMean.respond_to?(:correct_error)
      DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker)
    else
      DidYouMean::SPELL_CHECKERS["Gem::UnknownCommandError"] =
        Gem::UnknownCommandSpellChecker

      prepend DidYouMean::Correctable
    end
  end

  @attached = true
end

Instance Attribute Details

#unknown_command (readonly)

[ GitHub ]

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

attr_reader :unknown_command