Class: Bundler::Resolver::Strategy
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/resolver/strategy.rb |
Class Method Summary
- .new(source) ⇒ Strategy constructor
Instance Method Summary
Constructor Details
.new(source) ⇒ Strategy
# File 'lib/bundler/resolver/strategy.rb', line 6
def initialize(source) @source = source end
Instance Method Details
#most_preferred_version_of(package, range) (private)
[ GitHub ]# File 'lib/bundler/resolver/strategy.rb', line 27
def most_preferred_version_of(package, range) versions = @source.versions_for(package, range) # Conditional avoids (among other things) calling # sort_versions_by_preferred with the root package if versions.size > 1 @source.sort_versions_by_preferred(package, versions) else versions end end
#next_package_and_version(unsatisfied)
[ GitHub ]# File 'lib/bundler/resolver/strategy.rb', line 10
def next_package_and_version(unsatisfied) package, range = next_term_to_try_from(unsatisfied) [package, most_preferred_version_of(package, range).first] end
#next_term_to_try_from(unsatisfied) (private)
[ GitHub ]# File 'lib/bundler/resolver/strategy.rb', line 18
def next_term_to_try_from(unsatisfied) unsatisfied.min_by do |package, range| matching_versions = @source.versions_for(package, range) higher_versions = @source.versions_for(package, range.upper_invert) [matching_versions.count <= 1 ? 0 : 1, higher_versions.count] end end