Class: ClowderCommonRuby::AppMetadata
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ClowderCommonRuby::AppMetadata
- Defined in:
- lib/clowder-common-ruby/types.rb
Instance Attribute Summary collapse
-
#deployments ⇒ Object
Returns the value of attribute deployments.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ AppMetadata
constructor
A new instance of AppMetadata.
- #valid_keys ⇒ Object
Constructor Details
#initialize(attributes) ⇒ AppMetadata
Returns a new instance of AppMetadata.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/clowder-common-ruby/types.rb', line 91 def initialize(attributes) super raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash)) attributes = attributes.each_with_object({}) do |(k, v), h| warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym) h[k.to_sym] = v end @deployments = [] attributes.fetch(:deployments, []).each do |attr| @deployments << DeploymentMetadata.new(attr) end end |
Instance Attribute Details
#deployments ⇒ Object
Returns the value of attribute deployments.
89 90 91 |
# File 'lib/clowder-common-ruby/types.rb', line 89 def deployments @deployments end |
Instance Method Details
#valid_keys ⇒ Object
106 107 108 109 110 111 112 |
# File 'lib/clowder-common-ruby/types.rb', line 106 def valid_keys [].tap do |keys| keys << :name keys << :envName keys << :deployments end end |