123456789_123456789_123456789_123456789_123456789_

Exception: Gem::MissingSpecVersionError

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

Overview

Raised when trying to activate a gem, and the gem exists on the system, but not the requested version. 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, specs) ⇒ MissingSpecVersionError

[ GitHub ]

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

def initialize(name, requirement, specs)
  super(name, requirement)
  @specs = specs
end

Instance Attribute Details

#specs (readonly)

[ GitHub ]

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

attr_reader :specs

Instance Method Details

#build_message (private)

[ GitHub ]

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

def build_message
  if name == "bundler" && message = Gem::BundlerVersionFinder.missing_version_message
    return message
  end
  names = specs.map(&:full_name)
  "Could not find '#{name}' (#{requirement}) - did find: [#{names.join ','}]\n"
end