Class: Bundler::Resolver::Base
- Inherits:
-
Object
- Object
- Bundler::Resolver::Base
- Defined in:
- lib/bundler/resolver/base.rb
Instance Attribute Summary collapse
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
-
#requirements ⇒ Object
readonly
Returns the value of attribute requirements.
-
#source_requirements ⇒ Object
readonly
Returns the value of attribute source_requirements.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #base_requirements ⇒ Object
- #delete(specs) ⇒ Object
- #get_package(name) ⇒ Object
- #include_prereleases(names) ⇒ Object
-
#initialize(source_requirements, dependencies, base, platforms, options) ⇒ Base
constructor
A new instance of Base.
- #unlock_names(names) ⇒ Object
Constructor Details
#initialize(source_requirements, dependencies, base, platforms, options) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bundler/resolver/base.rb', line 10 def initialize(source_requirements, dependencies, base, platforms, ) @source_requirements = source_requirements @base = base @packages = Hash.new do |hash, name| hash[name] = Package.new(name, platforms, **) end @requirements = dependencies.map do |dep| dep_platforms = dep.gem_platforms(platforms) # Dependencies scoped to external platforms are ignored next if dep_platforms.empty? name = dep.name @packages[name] = Package.new(name, dep_platforms, **.merge(dependency: dep)) dep end.compact end |
Instance Attribute Details
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
8 9 10 |
# File 'lib/bundler/resolver/base.rb', line 8 def packages @packages end |
#requirements ⇒ Object (readonly)
Returns the value of attribute requirements.
8 9 10 |
# File 'lib/bundler/resolver/base.rb', line 8 def requirements @requirements end |
#source_requirements ⇒ Object (readonly)
Returns the value of attribute source_requirements.
8 9 10 |
# File 'lib/bundler/resolver/base.rb', line 8 def source_requirements @source_requirements end |
Instance Method Details
#[](name) ⇒ Object
33 34 35 |
# File 'lib/bundler/resolver/base.rb', line 33 def [](name) @base[name] end |
#base_requirements ⇒ Object
45 46 47 |
# File 'lib/bundler/resolver/base.rb', line 45 def base_requirements @base_requirements ||= build_base_requirements end |
#delete(specs) ⇒ Object
37 38 39 |
# File 'lib/bundler/resolver/base.rb', line 37 def delete(specs) @base.delete(specs) end |
#get_package(name) ⇒ Object
41 42 43 |
# File 'lib/bundler/resolver/base.rb', line 41 def get_package(name) @packages[name] end |
#include_prereleases(names) ⇒ Object
65 66 67 68 69 |
# File 'lib/bundler/resolver/base.rb', line 65 def include_prereleases(names) names.each do |name| get_package(name).consider_prereleases! end end |
#unlock_names(names) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/bundler/resolver/base.rb', line 49 def unlock_names(names) indirect_pins = indirect_pins(names) if indirect_pins.any? loosen_names(indirect_pins) else pins = pins(names) if pins.any? loosen_names(pins) else unrestrict_names(names) end end end |