Class: Megam::Mixins::Assembly

Inherits:
Object
  • Object
show all
Defined in:
lib/megam/mixins/assembly.rb

Constant Summary collapse

DEFAULT_VERTICE_PREFIX =
'vertice'.freeze
DEFAULT_DOCKER_PREFIX =
'docker'.freeze
TORPEDO =
'TORPEDO'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Assembly

Returns a new instance of Assembly.



12
13
14
15
16
17
18
19
20
21
# File 'lib/megam/mixins/assembly.rb', line 12

def initialize(params)
    params = Hash[params.map { |k, v| [k.to_sym, v] }]
    @id = params[:id] || params[:assemblyID] || ''
    @name = params[:assemblyname]
    @mixins = CommonDeployable.new(params)
    @outputs = Outputs.new(params)
    @components = add_components(params)
    @tosca_type = add_assembly_tosca_type(params)
    @policies = []
end

Instance Attribute Details

#componentsObject (readonly)

Returns the value of attribute components.



8
9
10
# File 'lib/megam/mixins/assembly.rb', line 8

def components
  @components
end

#envsObject (readonly)

Returns the value of attribute envs.



8
9
10
# File 'lib/megam/mixins/assembly.rb', line 8

def envs
  @envs
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/megam/mixins/assembly.rb', line 8

def id
  @id
end

#mixinsObject (readonly)

Returns the value of attribute mixins.



8
9
10
# File 'lib/megam/mixins/assembly.rb', line 8

def mixins
  @mixins
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/megam/mixins/assembly.rb', line 8

def name
  @name
end

#outputsObject (readonly)

Returns the value of attribute outputs.



8
9
10
# File 'lib/megam/mixins/assembly.rb', line 8

def outputs
  @outputs
end

#policiesObject (readonly)

Returns the value of attribute policies.



8
9
10
# File 'lib/megam/mixins/assembly.rb', line 8

def policies
  @policies
end

Instance Method Details

#to_hashObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/megam/mixins/assembly.rb', line 23

def to_hash
    result = @mixins.to_hash
    result[:id] = @id if @id
    result[:name] = @name if @name
    result[:components] = @components if @components
    result[:outputs] = @outputs.to_array if @outputs
    result[:policies] = @policies if @policies
    result[:tosca_type] = @tosca_type if @tosca_type
    result
end