class Bundler::Materialization

这个类将给定 gem 的一组已解析的规范('LazySpecification')转换为最合适的实际规范('StubSpecification'、'EndpointSpecification' 等),给定一个依赖项和一个目标平台。

属性

dep[R]
platform[R]

公共类方法

new(dep, platform, candidates:) 点击以切换源代码
# File bundler/materialization.rb, line 11
def initialize(dep, platform, candidates:)
  @dep = dep
  @platform = platform
  @candidates = candidates
end

公共实例方法

complete?() 点击以切换源代码
# File bundler/materialization.rb, line 17
def complete?
  specs.any?
end
completely_missing_specs() 点击以切换源代码
# File bundler/materialization.rb, line 39
def completely_missing_specs
  return [] unless specs.all?(&:missing?)

  specs
end
dependencies() 点击以切换源代码
# File bundler/materialization.rb, line 31
def dependencies
  specs.first.runtime_dependencies.map {|d| [d, platform] }
end
incomplete_specs() 点击以切换源代码
# File bundler/materialization.rb, line 49
def incomplete_specs
  return [] if complete?

  @candidates || LazySpecification.new(dep.name, nil, nil)
end
materialized_spec() 点击以切换源代码
# File bundler/materialization.rb, line 35
def materialized_spec
  specs.reject(&:missing?).first&.materialization
end
partially_missing_specs() 点击以切换源代码
# File bundler/materialization.rb, line 45
def partially_missing_specs
  specs.select(&:missing?)
end
specs() 点击以切换源代码
# File bundler/materialization.rb, line 21
def specs
  @specs ||= if @candidates.nil?
    []
  elsif platform
    GemHelpers.select_best_platform_match(@candidates, platform, force_ruby: dep.force_ruby_platform)
  else
    GemHelpers.select_best_local_platform_match(@candidates, force_ruby: dep.force_ruby_platform || dep.default_force_ruby_platform)
  end
end