Class: Build::Dependency::Chain
- Inherits:
-
Resolver
- Object
- Resolver
- Build::Dependency::Chain
show all
- Defined in:
- lib/build/dependency/chain.rb,
lib/build/dependency/partial_chain.rb
Instance Attribute Summary collapse
Attributes inherited from Resolver
#conflicts, #ordered, #provisions, #resolved, #unresolved
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(dependencies, providers, selection = []) ⇒ Chain
Returns a new instance of Chain.
41
42
43
44
45
46
47
48
49
|
# File 'lib/build/dependency/chain.rb', line 41
def initialize(dependencies, providers, selection = [])
super()
@selection = ::Set.new(selection)
@dependencies = dependencies.collect{|dependency| Depends[dependency]}
@providers = providers
expand_top
end
|
Instance Attribute Details
#dependencies ⇒ Object
55
56
57
|
# File 'lib/build/dependency/chain.rb', line 55
def dependencies
@dependencies
end
|
#providers ⇒ Object
58
59
60
|
# File 'lib/build/dependency/chain.rb', line 58
def providers
@providers
end
|
#selection ⇒ Object
52
53
54
|
# File 'lib/build/dependency/chain.rb', line 52
def selection
@selection
end
|
Class Method Details
.expand(*args) ⇒ Object
An ‘UnresolvedDependencyError` will be thrown if there are any unresolved dependencies.
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/build/dependency/chain.rb', line 29
def self.expand(*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
60
61
62
63
64
65
66
67
68
|
# File 'lib/build/dependency/chain.rb', line 60
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.expand(self, provider.dependencies)
end
|