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.



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

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.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def artifacts
  @artifacts
end

#envsObject (readonly)

Returns the value of attribute envs.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def envs
  @envs
end

#idObject (readonly)

Returns the value of attribute id.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def id
  @id
end

#mixinsObject (readonly)

Returns the value of attribute mixins.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def mixins
  @mixins
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def name
  @name
end

#operationsObject (readonly)

Returns the value of attribute operations.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def operations
  @operations
end

#outputsObject (readonly)

Returns the value of attribute outputs.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def outputs
  @outputs
end

Returns the value of attribute related_components.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def related_components
  @related_components
end

#repoObject (readonly)

Returns the value of attribute repo.



23
24
25
# File 'lib/megam/mixins/components.rb', line 23

def repo
  @repo
end

Instance Method Details

#to_aObject



49
50
51
# File 'lib/megam/mixins/components.rb', line 49

def to_a
  [to_hash]
end

#to_hashObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/megam/mixins/components.rb', line 36

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