Class: Build::Dependency::Chain
- Defined in:
- lib/build/dependency/chain.rb,
lib/build/dependency/partial_chain.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#providers ⇒ Object
readonly
Returns the value of attribute providers.
-
#selection ⇒ Object
readonly
Returns the value of attribute selection.
Attributes inherited from Resolver
#conflicts, #ordered, #provisions, #resolved, #unresolved
Class Method Summary collapse
-
.expand(*args) ⇒ Object
An ‘UnresolvedDependencyError` will be thrown if there are any unresolved dependencies.
Instance Method Summary collapse
- #freeze ⇒ Object
-
#initialize(dependencies, providers, selection = []) ⇒ Chain
constructor
A new instance of Chain.
- #partial(provider) ⇒ Object
Constructor Details
#initialize(dependencies, providers, selection = []) ⇒ Chain
Returns a new instance of Chain.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/build/dependency/chain.rb', line 39 def initialize(dependencies, providers, selection = []) super() # Explicitly selected dependencies which will be used when resolving ambiguity: @selection = Set.new(selection) # The list of dependencies that needs to be satisfied: @dependencies = dependencies.collect{|dependency| Depends[dependency]} # The available providers which match up to required dependencies: @providers = providers end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
55 56 57 |
# File 'lib/build/dependency/chain.rb', line 55 def dependencies @dependencies end |
#providers ⇒ Object (readonly)
Returns the value of attribute providers.
56 57 58 |
# File 'lib/build/dependency/chain.rb', line 56 def providers @providers end |
#selection ⇒ Object (readonly)
Returns the value of attribute selection.
54 55 56 |
# File 'lib/build/dependency/chain.rb', line 54 def selection @selection end |
Class Method Details
.expand(*args) ⇒ Object
An ‘UnresolvedDependencyError` will be thrown if there are any unresolved dependencies.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/build/dependency/chain.rb', line 27 def self.(*args) chain = self.new(*args) chain.freeze if chain.unresolved.size > 0 raise UnresolvedDependencyError.new(chain) end return chain end |
Instance Method Details
#freeze ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/build/dependency/chain.rb', line 58 def freeze return unless frozen? @selection.freeze @dependencies.freeze @providers.freeze super end |
#partial(provider) ⇒ Object
26 27 28 |
# File 'lib/build/dependency/partial_chain.rb', line 26 def partial(provider) PartialChain.(self, provider.dependencies) end |