Class: Kontena::Stacks::StackData

Inherits:
Object
  • Object
show all
Defined in:
lib/kontena/stacks/stack_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, loader = nil) ⇒ StackData

Returns a new instance of StackData.

Parameters:

  • data (Hash)
  • loader (StackFileLoader, NilClass) (defaults to: nil)


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

#loaderObject (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

#dataHash

Returns:

  • (Hash)


54
55
56
# File 'lib/kontena/stacks/stack_data.rb', line 54

def data
  @data.dup
end

#nameString

Returns:



14
15
16
# File 'lib/kontena/stacks/stack_data.rb', line 14

def name
  @data['name']
end

#parentString

Returns:



34
35
36
# File 'lib/kontena/stacks/stack_data.rb', line 34

def parent
  @data.dig('parent', 'name')
end

#root?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/kontena/stacks/stack_data.rb', line 29

def root?
  parent.nil?
end

#service_namesArray<String>

Returns:



49
50
51
# File 'lib/kontena/stacks/stack_data.rb', line 49

def service_names
  @data['services'].map { |s| s['name']}
end

#servicesArray<Hash>

Returns:

  • (Array<Hash>)


44
45
46
# File 'lib/kontena/stacks/stack_data.rb', line 44

def services
  @data['services']
end

#stack_nameString

Returns:



19
20
21
# File 'lib/kontena/stacks/stack_data.rb', line 19

def stack_name
  @data['stack']
end

#variablesHash

Returns:

  • (Hash)


39
40
41
# File 'lib/kontena/stacks/stack_data.rb', line 39

def variables
  @data['variables']
end

#versionString

Returns:



24
25
26
# File 'lib/kontena/stacks/stack_data.rb', line 24

def version
  @data['version']
end