class Bundler::Resolver::Package

Represents a gem being resolved, in a format PubGrub likes.

The class holds the following information:

  • Platforms this gem will be resolved on.

  • The locked version of this gem resolution should favor (if any).

  • Whether the gem should be unlocked to its latest version.

  • The dependency explicit set in the Gemfile for this gem (if any).

Attributes

dependency[R]
locked_version[R]
name[R]
platforms[R]

Public Class Methods

new(name, platforms, locked_specs, unlock, dependency: nil) click to toggle source
# File bundler/resolver/package.rb, line 18
def initialize(name, platforms, locked_specs, unlock, dependency: nil)
  @name = name
  @platforms = platforms
  @locked_version = locked_specs[name].first&.version
  @unlock = unlock
  @dependency = dependency || Dependency.new(name, @locked_version)
end

Public Instance Methods

==(other) click to toggle source
# File bundler/resolver/package.rb, line 38
def ==(other)
  self.class == other.class && @name == other.name
end
current_platform?() click to toggle source
# File bundler/resolver/package.rb, line 58
def current_platform?
  @dependency.current_platform?
end
force_ruby_platform?() click to toggle source
# File bundler/resolver/package.rb, line 54
def force_ruby_platform?
  @dependency.force_ruby_platform
end
hash() click to toggle source
# File bundler/resolver/package.rb, line 42
def hash
  @name.hash
end
meta?() click to toggle source
# File bundler/resolver/package.rb, line 34
def meta?
  @name.end_with?("\0")
end
prerelease_specified?() click to toggle source
# File bundler/resolver/package.rb, line 50
def prerelease_specified?
  @dependency.prerelease?
end
root?() click to toggle source
# File bundler/resolver/package.rb, line 30
def root?
  false
end
to_s() click to toggle source
# File bundler/resolver/package.rb, line 26
def to_s
  @name.delete("\0")
end
unlock?() click to toggle source
# File bundler/resolver/package.rb, line 46
def unlock?
  @unlock.empty? || @unlock.include?(name)
end