class Gem::UnsatisfiableDependencyError - Documentation for Ruby 4.0
Description: class Gem::UnsatisfiableDependencyError: Raised by Resolver when a dependency requests a gem for which there is no spec.
Keywords: ruby,class,Gem::UnsatisfiableDependencyError

🔍

No recent searches

# class Gem::UnsatisfiableDependencyError

Raised by Resolver when a dependency requests a gem for which there is no spec.

### Attributes

dependency [R]

The unsatisfiable dependency. This is a `Gem::Resolver::DependencyRequest`, not a `Gem::Dependency`

errors [RW]

Errors encountered which may have contributed to this exception

### Public Class Methods

new (dep, platform_mismatch = nil)
Source

    # File lib/rubygems/exceptions.rb, line 254
    def initialize(dep, platform_mismatch = nil)
      if platform_mismatch && !platform_mismatch.empty?
        plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
        super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(", ")}"
      else
        if dep.explicit?
          super "Unable to resolve dependency: user requested '#{dep}'"
        else
          super "Unable to resolve dependency: '#{dep.request_context}' requires '#{dep}'"
        end
      end

      @dependency = dep
      @errors     = []
    end

Creates a new `UnsatisfiableDependencyError` for the unsatisfiable `Gem::Resolver::DependencyRequest` `dep`

Calls superclass method `Exception::new`

### Public Instance Methods

name ()
Source

    # File lib/rubygems/exceptions.rb, line 273
    def name
      @dependency.name
    end

The name of the unresolved dependency

version ()
Source

    # File lib/rubygems/exceptions.rb, line 280
    def version
      @dependency.requirement
    end

The Requirement of the unresolved dependency (not Version).