Class: Librarian::Resolver
- Inherits:
-
Object
- Object
- Librarian::Resolver
- Defined in:
- lib/librarian/resolver.rb,
lib/librarian/resolver/implementation.rb
Defined Under Namespace
Classes: Implementation
Instance Attribute Summary collapse
-
#cyclic ⇒ Object
readonly
Returns the value of attribute cyclic.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
Instance Method Summary collapse
-
#initialize(environment, options = { }) ⇒ Resolver
constructor
Options: cyclic: truthy if the resolver should permit cyclic resolutions.
- #resolve(spec, partial_manifests = []) ⇒ Object
Constructor Details
#initialize(environment, options = { }) ⇒ Resolver
Options:
cyclic: truthy if the resolver should permit cyclic resolutions
14 15 16 17 18 19 20 |
# File 'lib/librarian/resolver.rb', line 14 def initialize(environment, = { }) = .keys - [:cyclic] .empty? or raise Error, "unrecognized options: #{.join(", ")}" self.environment = environment self.cyclic = !![:cyclic] end |
Instance Attribute Details
#cyclic ⇒ Object
Returns the value of attribute cyclic.
9 10 11 |
# File 'lib/librarian/resolver.rb', line 9 def cyclic @cyclic end |
#environment ⇒ Object
Returns the value of attribute environment.
9 10 11 |
# File 'lib/librarian/resolver.rb', line 9 def environment @environment end |
Instance Method Details
#resolve(spec, partial_manifests = []) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/librarian/resolver.rb', line 22 def resolve(spec, partial_manifests = []) manifests = implementation(spec).resolve(partial_manifests) manifests or return enforce_consistency!(spec.dependencies, manifests) enforce_acyclicity!(manifests) unless cyclic manifests = sort(manifests) Resolution.new(spec.dependencies, manifests) end |