class Gem::MissingSpecError - Documentation for Ruby 4.0
Description: class Gem::MissingSpecError: Raised when trying to activate a gem, and that gem does not exist on the system. LoadError to catch all types of load errors.
Keywords: ruby,class,Gem::MissingSpecError

🔍

No recent searches

# class Gem::MissingSpecError

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

### Public Class Methods

new (name, requirement, extra_message = nil)
Source

    # File lib/rubygems/errors.rb, line 29
    def initialize(name, requirement, extra_message = nil)
      @name        = name
      @requirement = requirement
      @extra_message = extra_message
      super(message)
    end

Calls superclass method `Exception::new`

### Private Instance Methods

build_message ()
Source

    # File lib/rubygems/errors.rb, line 43
    def build_message
      total = Gem::Specification.stubs.size
      "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n"
    end