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
# File 'lib/megam/mixins/components.rb', line 9

def initialize(params)
  @mixins = CommonDeployable.new(params)
  @name = params[:componentname]
  @outputs = Outputs.new(params)
  @operations = add_operations(params)
  @related_components = add_related_components(params)
  @artifacts = add_artifacts(params)
  @repo = add_repo(params)
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

#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



30
31
32
# File 'lib/megam/mixins/components.rb', line 30

def to_a
	[to_hash]
end

#to_hashObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/megam/mixins/components.rb', line 19

def to_hash
  result = @mixins.to_hash
  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
end