class Megam::Mixins::Components
Constants
- DEFAULT_VERTICE_PREFIX
Attributes
artifacts[R]
envs[R]
id[R]
mixins[R]
name[R]
operations[R]
outputs[R]
repo[R]
tosca_type[R]
Public Class Methods
new(params)
click to toggle source
# File lib/megam/mixins/components.rb, line 10 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] @tosca_type = add_components_tosca_type(params) end
Public Instance Methods
to_a()
click to toggle source
# File lib/megam/mixins/components.rb, line 37 def to_a [to_hash] end
to_hash()
click to toggle source
# File lib/megam/mixins/components.rb, line 23 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[:tosca_type] = @tosca_type if @tosca_type result.to_hash end
Private Instance Methods
add_artifacts(params)
click to toggle source
# File lib/megam/mixins/components.rb, line 63 def add_artifacts(params) Artifacts.new(params).tohash end
add_components_tosca_type(params)
click to toggle source
# File lib/megam/mixins/components.rb, line 67 def add_components_tosca_type(params) if params[:scm_name] !=nil @tosca_type = params[:scm_name] + ".#{params[:cattype].downcase}.#{params[:mkp_name].downcase}" if params[:cattype] != nil && params[:mkp_name] != nil else @tosca_type = DEFAULT_VERTICE_PREFIX + ".#{params[:cattype].downcase}.#{params[:mkp_name].downcase}" if params[:cattype] != nil && params[:mkp_name] != nil end end
add_operations(params)
click to toggle source
# File lib/megam/mixins/components.rb, line 52 def add_operations(params) operations = [] operations.push(create_operation(Operations::CI, Operations::CI_DESCRIPTON, params)) if params.key?(:scm_name) && params.key?(:scmtoken) operations.push(create_operation(Operations::BIND, Operations::BIND_DESCRIPTON, params)) if params.key?(:bind_type) operations end
add_repo(params)
click to toggle source
# File lib/megam/mixins/components.rb, line 43 def add_repo(params) Repo.new(params).tohash end
create_operation(type, desc, params)
click to toggle source
# File lib/megam/mixins/components.rb, line 59 def create_operation(type, desc, params) Operations.new(params, type, desc).tohash end