Class: Teapot::Select
- Inherits:
-
Object
- Object
- Teapot::Select
- Defined in:
- lib/teapot/select.rb
Overview
A selection is a specific view of the data exposed by the context at a specific point in time.
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Alises as defined by Configuration#targets.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#configurations ⇒ Object
readonly
All public configurations.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#projects ⇒ Object
readonly
Returns the value of attribute projects.
-
#resolved ⇒ Object
readonly
Returns the value of attribute resolved.
-
#selection ⇒ Object
readonly
Returns the value of attribute selection.
-
#targets ⇒ Object
readonly
Returns the value of attribute targets.
-
#unresolved ⇒ Object
readonly
Returns the value of attribute unresolved.
Instance Method Summary collapse
- #chain ⇒ Object
- #direct_targets(ordered) ⇒ Object
-
#initialize(context, configuration, names = []) ⇒ Select
constructor
A new instance of Select.
Constructor Details
#initialize(context, configuration, names = []) ⇒ Select
Returns a new instance of Select.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/teapot/select.rb', line 43 def initialize(context, configuration, names = []) @context = context @configuration = Configuration.new(context, configuration.package, configuration.name, [], configuration.) @targets = {} @configurations = {} @projects = {} @dependencies = [] @selection = Set.new @resolved = Build::Dependency::Set.new @unresolved = Build::Dependency::Set.new load!(configuration, names) @chain = nil end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Alises as defined by Configuration#targets
68 69 70 |
# File 'lib/teapot/select.rb', line 68 def aliases @aliases end |
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
62 63 64 |
# File 'lib/teapot/select.rb', line 62 def configuration @configuration end |
#configurations ⇒ Object (readonly)
All public configurations.
71 72 73 |
# File 'lib/teapot/select.rb', line 71 def configurations @configurations end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
61 62 63 |
# File 'lib/teapot/select.rb', line 61 def context @context end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
73 74 75 |
# File 'lib/teapot/select.rb', line 73 def dependencies @dependencies end |
#projects ⇒ Object (readonly)
Returns the value of attribute projects.
65 66 67 |
# File 'lib/teapot/select.rb', line 65 def projects @projects end |
#resolved ⇒ Object (readonly)
Returns the value of attribute resolved.
76 77 78 |
# File 'lib/teapot/select.rb', line 76 def resolved @resolved end |
#selection ⇒ Object (readonly)
Returns the value of attribute selection.
74 75 76 |
# File 'lib/teapot/select.rb', line 74 def selection @selection end |
#targets ⇒ Object (readonly)
Returns the value of attribute targets.
64 65 66 |
# File 'lib/teapot/select.rb', line 64 def targets @targets end |
#unresolved ⇒ Object (readonly)
Returns the value of attribute unresolved.
77 78 79 |
# File 'lib/teapot/select.rb', line 77 def unresolved @unresolved end |
Instance Method Details
#chain ⇒ Object
79 80 81 |
# File 'lib/teapot/select.rb', line 79 def chain @chain ||= Build::Dependency::Chain.(@dependencies, @targets.values, @selection) end |
#direct_targets(ordered) ⇒ Object
83 84 85 86 87 |
# File 'lib/teapot/select.rb', line 83 def direct_targets(ordered) @dependencies.collect do |dependency| ordered.find{|(package, _)| package.provides? dependency} end.compact end |