Class: Kontena::Stacks::StackData
- Inherits:
-
Object
- Object
- Kontena::Stacks::StackData
- Defined in:
- lib/kontena/stacks/stack_data.rb
Instance Attribute Summary collapse
-
#loader ⇒ Object
readonly
Returns the value of attribute loader.
Instance Method Summary collapse
- #data ⇒ Hash
-
#initialize(data, loader = nil) ⇒ StackData
constructor
A new instance of StackData.
- #name ⇒ String
- #parent ⇒ String
- #root? ⇒ Boolean
- #service_names ⇒ Array<String>
- #services ⇒ Array<Hash>
- #stack_name ⇒ String
- #variables ⇒ Hash
- #version ⇒ String
Constructor Details
#initialize(data, loader = nil) ⇒ StackData
Returns a new instance of StackData.
8 9 10 11 |
# File 'lib/kontena/stacks/stack_data.rb', line 8 def initialize(data, loader = nil) @data = data @loader = loader end |
Instance Attribute Details
#loader ⇒ Object (readonly)
Returns the value of attribute loader.
4 5 6 |
# File 'lib/kontena/stacks/stack_data.rb', line 4 def loader @loader end |
Instance Method Details
#data ⇒ Hash
54 55 56 |
# File 'lib/kontena/stacks/stack_data.rb', line 54 def data @data.dup end |
#name ⇒ String
14 15 16 |
# File 'lib/kontena/stacks/stack_data.rb', line 14 def name @data['name'] end |
#parent ⇒ String
34 35 36 |
# File 'lib/kontena/stacks/stack_data.rb', line 34 def parent @data.dig('parent', 'name') end |
#root? ⇒ Boolean
29 30 31 |
# File 'lib/kontena/stacks/stack_data.rb', line 29 def root? parent.nil? end |
#service_names ⇒ Array<String>
49 50 51 |
# File 'lib/kontena/stacks/stack_data.rb', line 49 def service_names @data['services'].map { |s| s['name']} end |
#services ⇒ Array<Hash>
44 45 46 |
# File 'lib/kontena/stacks/stack_data.rb', line 44 def services @data['services'] end |
#stack_name ⇒ String
19 20 21 |
# File 'lib/kontena/stacks/stack_data.rb', line 19 def stack_name @data['stack'] end |
#variables ⇒ Hash
39 40 41 |
# File 'lib/kontena/stacks/stack_data.rb', line 39 def variables @data['variables'] end |
#version ⇒ String
24 25 26 |
# File 'lib/kontena/stacks/stack_data.rb', line 24 def version @data['version'] end |