class Gem::MissingSpecVersionError - Documentation for Ruby 4.0
Description: class Gem::MissingSpecVersionError: Raised when trying to activate a gem, and the gem exists on the system, but not the requested version. LoadError to catch all types of load errors.
Keywords: ruby,class,Gem::MissingSpecVersionError

🔍

No recent searches

# class Gem::MissingSpecVersionError

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 `Gem::LoadError` to catch all types of load errors.

### Attributes

specs [R]

### Public Class Methods

new (name, requirement, specs)
Source

    # File lib/rubygems/errors.rb, line 56
    def initialize(name, requirement, specs)
      @specs = specs
      super(name, requirement)
    end

Calls superclass method `Gem::MissingSpecError::new`

### Private Instance Methods

build_message ()
Source

    # File lib/rubygems/errors.rb, line 63
    def build_message
      names = specs.map(&:full_name)
      "Could not find '#{name}' (#{requirement}) - did find: [#{names.join ","}]\n"
    end