123456789_123456789_123456789_123456789_123456789_

Exception: Gem::MissingSpecError

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, LoadError, LoadError
Instance Chain:
self, LoadError, LoadError
Inherits: Gem::LoadError
Defined in: lib/rubygems/errors.rb

Overview

Raised when trying to activate a gem, and that gem does not exist on the system. Instead of rescuing from this class, make sure to rescue from the superclass LoadError to catch all types of load errors.

Class Method Summary

Instance Attribute Summary

LoadError - Inherited

#name

Name of gem.

#requirement

Version requirement of gem.

Instance Method Summary

Constructor Details

.new(name, requirement, extra_message = nil) ⇒ MissingSpecError

[ GitHub ]

  
# File 'lib/rubygems/errors.rb', line 29

def initialize(name, requirement, extra_message=nil)
  @name        = name
  @requirement = requirement
  @extra_message = extra_message
end

Instance Method Details

#build_message (private)

[ GitHub ]

  
# File 'lib/rubygems/errors.rb', line 42

def build_message
  total = Gem::Specification.stubs.size
  "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n"
end

#message

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/errors.rb', line 35

def message # :nodoc:
  build_message +
    "Checked in 'GEM_PATH=#{Gem.path.join(File::PATH_SEPARATOR)}' #{@extra_message}, execute `gem env` for more information"
end