Class: Kontena::Stacks::StackDataSet
- Inherits:
-
Object
- Object
- Kontena::Stacks::StackDataSet
- Defined in:
- lib/kontena/stacks/stack_data_set.rb
Instance Method Summary collapse
- #delete(name) ⇒ StackData, NilClass
-
#initialize(data) ⇒ StackDataSet
constructor
A new instance of StackDataSet.
- #remove_dependencies ⇒ Array<StackData>
- #size ⇒ Integer
- #stack(name) ⇒ StackData, NilClass (also: #[])
- #stack_names ⇒ Array<String>
- #stacks ⇒ Array<StackData>
Constructor Details
#initialize(data) ⇒ StackDataSet
Returns a new instance of StackDataSet.
7 8 9 |
# File 'lib/kontena/stacks/stack_data_set.rb', line 7 def initialize(data) @data = data end |
Instance Method Details
#delete(name) ⇒ StackData, NilClass
39 40 41 42 |
# File 'lib/kontena/stacks/stack_data_set.rb', line 39 def delete(name) data = @data.delete(name) StackData.new(data[:stack_data], data[:loader]) if data end |
#remove_dependencies ⇒ Array<StackData>
45 46 47 48 49 |
# File 'lib/kontena/stacks/stack_data_set.rb', line 45 def remove_dependencies stacks.map do |stack| delete(stack.name) unless stack.root? end.compact end |
#size ⇒ Integer
33 34 35 |
# File 'lib/kontena/stacks/stack_data_set.rb', line 33 def size @data.size end |
#stack(name) ⇒ StackData, NilClass Also known as: []
13 14 15 16 |
# File 'lib/kontena/stacks/stack_data_set.rb', line 13 def stack(name) data = @data[name] StackData.new(data[:stack_data], data[:loader]) if data end |
#stack_names ⇒ Array<String>
28 29 30 |
# File 'lib/kontena/stacks/stack_data_set.rb', line 28 def stack_names @data.keys end |
#stacks ⇒ Array<StackData>
21 22 23 24 25 |
# File 'lib/kontena/stacks/stack_data_set.rb', line 21 def stacks stack_names.map do |name| stack(name) end.compact end |