[rubygems/rubygems] Extract builder to create a `LazySpecification` from full spec

https://github.com/rubygems/rubygems/commit/957d3d9a7f
This commit is contained in:
David Rodríguez 2023-03-16 17:23:19 +01:00 коммит произвёл Hiroshi SHIBATA
Родитель 58b0a67432
Коммит f273132bc0
2 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -10,6 +10,14 @@ module Bundler
attr_reader :name, :version, :platform
attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
def self.from_spec(s)
lazy_spec = new(s.name, s.version, s.platform, s.source)
lazy_spec.dependencies = s.dependencies
lazy_spec.required_ruby_version = s.required_ruby_version
lazy_spec.required_rubygems_version = s.required_rubygems_version
lazy_spec
end
def initialize(name, version, platform, source = nil)
@name = name
@version = version

Просмотреть файл

@ -25,11 +25,8 @@ module Bundler
def to_specs(force_ruby_platform)
@specs.map do |s|
lazy_spec = LazySpecification.new(name, version, s.platform, source)
lazy_spec = LazySpecification.from_spec(s)
lazy_spec.force_ruby_platform = force_ruby_platform
lazy_spec.dependencies = s.dependencies
lazy_spec.required_ruby_version = s.required_ruby_version
lazy_spec.required_rubygems_version = s.required_rubygems_version
lazy_spec
end
end