Class: Librarian::Resolver::Implementation
- Inherits:
-
Object
- Object
- Librarian::Resolver::Implementation
- Defined in:
- lib/librarian/resolver/implementation.rb
Defined Under Namespace
Classes: MultiSource, State
Instance Attribute Summary collapse
-
#cyclic ⇒ Object
readonly
Returns the value of attribute cyclic.
-
#resolver ⇒ Object
readonly
Returns the value of attribute resolver.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Instance Method Summary collapse
-
#initialize(resolver, spec, options = { }) ⇒ Implementation
constructor
A new instance of Implementation.
- #resolve(manifests) ⇒ Object
Constructor Details
#initialize(resolver, spec, options = { }) ⇒ Implementation
Returns a new instance of Implementation.
36 37 38 39 40 41 42 43 44 |
# File 'lib/librarian/resolver/implementation.rb', line 36 def initialize(resolver, spec, = { }) = .keys - [:cyclic] .empty? or raise Error, "unrecognized options: #{.join(", ")}" self.resolver = resolver self.spec = spec self.cyclic = !![:cyclic] @level = 0 end |
Instance Attribute Details
#cyclic ⇒ Object
Returns the value of attribute cyclic.
33 34 35 |
# File 'lib/librarian/resolver/implementation.rb', line 33 def cyclic @cyclic end |
#resolver ⇒ Object
Returns the value of attribute resolver.
33 34 35 |
# File 'lib/librarian/resolver/implementation.rb', line 33 def resolver @resolver end |
#spec ⇒ Object
Returns the value of attribute spec.
33 34 35 |
# File 'lib/librarian/resolver/implementation.rb', line 33 def spec @spec end |
Instance Method Details
#resolve(manifests) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/librarian/resolver/implementation.rb', line 46 def resolve(manifests) manifests = index_by(manifests, &:name) if manifests.kind_of?(Array) queue = spec.dependencies + sourced_dependencies_for_manifests(manifests) state = State.new(manifests.dup, [], queue) recursive_resolve(state) end |