Skip to content

Commit a57469e

Browse files
Extract builder to create a LazySpecification from full spec
1 parent 46d1838 commit a57469e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

bundler/lib/bundler/lazy_specification.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ class LazySpecification
1010
attr_reader :name, :version, :platform
1111
attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version
1212

13+
def self.from_spec(s)
14+
lazy_spec = new(s.name, s.version, s.platform, s.source)
15+
lazy_spec.dependencies = s.dependencies
16+
lazy_spec.required_ruby_version = s.required_ruby_version
17+
lazy_spec.required_rubygems_version = s.required_rubygems_version
18+
lazy_spec
19+
end
20+
1321
def initialize(name, version, platform, source = nil)
1422
@name = name
1523
@version = version

bundler/lib/bundler/resolver/spec_group.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ def source
2525

2626
def to_specs(force_ruby_platform)
2727
@specs.map do |s|
28-
lazy_spec = LazySpecification.new(name, version, s.platform, source)
28+
lazy_spec = LazySpecification.from_spec(s)
2929
lazy_spec.force_ruby_platform = force_ruby_platform
30-
lazy_spec.dependencies = s.dependencies
31-
lazy_spec.required_ruby_version = s.required_ruby_version
32-
lazy_spec.required_rubygems_version = s.required_rubygems_version
3330
lazy_spec
3431
end
3532
end

0 commit comments

Comments
 (0)