Class: Megam::Mixins::Components

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Components

Returns a new instance of Components.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/megam/mixins/components.rb', line 9

def initialize(params)
    @mixins = CommonDeployable.new(params)
    @id = params[:id] if params[:id]
    @name = params[:componentname] || params[:name] || ''
    @outputs = Outputs.new(params)
    @operations = add_operations(params)
    @related_components = add_related_components(params)
    @artifacts = add_artifacts(params)
    @repo = add_repo(params)
    @envs = params[:envs]
end

Instance Attribute Details

#artifactsObject (readonly)

Returns the value of attribute artifacts.



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

def artifacts
  @artifacts
end

#envsObject (readonly)

Returns the value of attribute envs.



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

def envs
  @envs
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#mixinsObject (readonly)

Returns the value of attribute mixins.



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

def mixins
  @mixins
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#operationsObject (readonly)

Returns the value of attribute operations.



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

def operations
  @operations
end

#outputsObject (readonly)

Returns the value of attribute outputs.



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

def outputs
  @outputs
end

Returns the value of attribute related_components.



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

def related_components
  @related_components
end

#repoObject (readonly)

Returns the value of attribute repo.



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

def repo
  @repo
end

Instance Method Details

#to_aObject



34
35
36
# File 'lib/megam/mixins/components.rb', line 34

def to_a
    [to_hash]
end

#to_hashObject



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

def to_hash
    result = @mixins.to_hash
    result[:id] = @id if @id
    result[:name] = @name if @name
    result[:artifacts] = @artifacts if @artifacts
    result[:repo] = @repo if @repo
    result[:operations] = @operations if @operations
    result[:outputs] = @outputs.to_array if @outputs
    result[:related_components] = @related_components if @related_components
    result[:envs] = @envs if @envs
    result.to_hash
end