class Bundler::Resolver::Package
以 PubGrub
喜欢的格式表示正在解析的 gem。
该类包含以下信息:
-
此 gem 将在其上解析的平台。
-
此 gem 解析应优先使用的锁定版本(如果有)。
-
是否应将 gem 解锁到其最新版本。
-
Gemfile 中为此 gem 显式设置的依赖项(如果有)。
属性
dependency[R]
locked_version[R]
name[R]
platforms[R]
公共类方法
new(name, platforms, locked_specs:, unlock:, prerelease: false, prefer_local: false, dependency: nil) 点击以切换源代码
# File bundler/resolver/package.rb, line 18 def initialize(name, platforms, locked_specs:, unlock:, prerelease: false, prefer_local: false, dependency: nil) @name = name @platforms = platforms @locked_version = locked_specs[name].first&.version @unlock = unlock @dependency = dependency || Dependency.new(name, @locked_version) @top_level = !dependency.nil? @prerelease = @dependency.prerelease? || @locked_version&.prerelease? || prerelease ? :consider_first : :ignore @prefer_local = prefer_local end
公共实例方法
==(other) 点击以切换源代码
# File bundler/resolver/package.rb, line 49 def ==(other) self.class == other.class && @name == other.name end
consider_prereleases!() 点击以切换源代码
# File bundler/resolver/package.rb, line 69 def consider_prereleases! @prerelease = :consider_last end
consider_remote_versions!() 点击以切换源代码
# File bundler/resolver/package.rb, line 77 def consider_remote_versions! @prefer_local = false end
current_platform?() 点击以切换源代码
# File bundler/resolver/package.rb, line 85 def current_platform? @dependency.current_platform? end
force_ruby_platform?() 点击以切换源代码
# File bundler/resolver/package.rb, line 81 def force_ruby_platform? @dependency.force_ruby_platform end
hash() 点击以切换源代码
# File bundler/resolver/package.rb, line 53 def hash @name.hash end
ignores_prereleases?() 点击以切换源代码
# File bundler/resolver/package.rb, line 61 def ignores_prereleases? @prerelease == :ignore end
meta?() 点击以切换源代码
# File bundler/resolver/package.rb, line 45 def meta? @name.end_with?("\0") end
platform_specs(specs) 点击以切换源代码
# File bundler/resolver/package.rb, line 29 def platform_specs(specs) platforms.map {|platform| GemHelpers.select_best_platform_match(specs, platform, prefer_locked: !unlock?) } end
prefer_local?() 点击以切换源代码
# File bundler/resolver/package.rb, line 73 def prefer_local? @prefer_local end
prerelease_specified?() 点击以切换源代码
# File bundler/resolver/package.rb, line 65 def prerelease_specified? @prerelease == :consider_first end
root?() 点击以切换源代码
# File bundler/resolver/package.rb, line 37 def root? false end
to_s() 点击以切换源代码
# File bundler/resolver/package.rb, line 33 def to_s @name.delete("\0") end
top_level?() 点击以切换源代码
# File bundler/resolver/package.rb, line 41 def top_level? @top_level end
unlock?() 点击以切换源代码
# File bundler/resolver/package.rb, line 57 def unlock? @unlock.empty? || @unlock.include?(name) end