Class: Bundler::PubGrub::Strategy
- Inherits:
-
Object
- Object
- Bundler::PubGrub::Strategy
- Defined in:
- lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb
Instance Method Summary collapse
-
#initialize(source) ⇒ Strategy
constructor
A new instance of Strategy.
- #next_package_and_version(unsatisfied) ⇒ Object
Constructor Details
#initialize(source) ⇒ Strategy
Returns a new instance of Strategy.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb', line 3 def initialize(source) @source = source @root_package = Package.root @root_version = Package.root_version @version_indexes = Hash.new do |h,k| if k == @root_package h[k] = { @root_version => 0 } else h[k] = @source.all_versions_for(k).each.with_index.to_h end end end |
Instance Method Details
#next_package_and_version(unsatisfied) ⇒ Object
18 19 20 21 22 |
# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb', line 18 def next_package_and_version(unsatisfied) package, range = next_term_to_try_from(unsatisfied) [package, most_preferred_version_of(package, range)] end |