Class: Megam::Mixins::CommonDeployable
- Inherits:
-
Object
- Object
- Megam::Mixins::CommonDeployable
- Includes:
- Nilavu::MegamAttributes
- Defined in:
- lib/megam/mixins/common_deployable.rb
Constant Summary collapse
- DEFAULT_TOSCA_PREFIX =
'tosca'.freeze
- DEFAULT_TOSCA_SUFFIX =
this is a mutable string, if nothing exists then we use ubuntu
'ubuntu'.freeze
- ATTRIBUTES =
[ :tosca_type, :status, :inputs]
Constants included from Nilavu::MegamAttributes
Nilavu::MegamAttributes::KEY, Nilavu::MegamAttributes::VALUE
Instance Attribute Summary collapse
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tosca_type ⇒ Object
readonly
Returns the value of attribute tosca_type.
Instance Method Summary collapse
- #attributes ⇒ Object
- #bld_toscatype(params) ⇒ Object
-
#initialize(params) ⇒ CommonDeployable
constructor
A new instance of CommonDeployable.
- #to_hash ⇒ Object
Methods included from Nilavu::MegamAttributes
Constructor Details
#initialize(params) ⇒ CommonDeployable
Returns a new instance of CommonDeployable.
37 38 39 40 41 42 43 44 |
# File 'lib/megam/mixins/common_deployable.rb', line 37 def initialize(params) @tosca_type = '' @status = 'launching' bld_toscatype(params) set_attributes(params) @inputs = InputGroupData.new(params) end |
Instance Attribute Details
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
22 23 24 |
# File 'lib/megam/mixins/common_deployable.rb', line 22 def inputs @inputs end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
22 23 24 |
# File 'lib/megam/mixins/common_deployable.rb', line 22 def status @status end |
#tosca_type ⇒ Object (readonly)
Returns the value of attribute tosca_type.
22 23 24 |
# File 'lib/megam/mixins/common_deployable.rb', line 22 def tosca_type @tosca_type end |
Instance Method Details
#attributes ⇒ Object
33 34 35 |
# File 'lib/megam/mixins/common_deployable.rb', line 33 def attributes ATTRIBUTES end |
#bld_toscatype(params) ⇒ Object
54 55 56 57 58 |
# File 'lib/megam/mixins/common_deployable.rb', line 54 def bld_toscatype(params) tosca_suffix = DEFAULT_TOSCA_SUFFIX tosca_suffix = "#{params[:mkp_name]}" unless params[:cattype] != 'TORPEDO'.freeze @tosca_type = DEFAULT_TOSCA_PREFIX + ".#{params[:cattype].downcase}.#{params[:mkp_name].downcase}" if params[:cattype] != nil && params[:mkp_name] != nil end |
#to_hash ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/megam/mixins/common_deployable.rb', line 46 def to_hash h = { status: status, tosca_type: tosca_type, inputs: inputs.to_hash } end |