Class: Ridley::EnvironmentResource
- Defined in:
- lib/ridley/resources/environment_resource.rb
Overview
Class Method Summary collapse
-
.delete_all(client) ⇒ Array<Ridley::EnvironmentResource>
Delete all of the environments on the client.
Instance Method Summary collapse
-
#set_default_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level default attribute given the dotted path representation of the Chef attribute and value.
-
#set_override_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level override attribute given the dotted path representation of the Chef attribute and value.
Methods inherited from Resource
#<=>, #==, all, #chef_id, chef_id, chef_json_class, chef_type, create, delete, #eql?, find, find!, #hash, #initialize, #reload, resource_path, #save, set_chef_id, set_chef_json_class, set_chef_type, set_resource_path, #to_s, update, #update
Constructor Details
This class inherits a constructor from Ridley::Resource
Class Method Details
.delete_all(client) ⇒ Array<Ridley::EnvironmentResource>
Delete all of the environments on the client. The ‘_default’ environment will never be deleted.
11 12 13 14 |
# File 'lib/ridley/resources/environment_resource.rb', line 11 def delete_all(client) envs = all(client).reject { |env| env.name.to_s == '_default' } envs.collect { |obj| delete(client, obj) } end |
Instance Method Details
#set_default_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level default attribute given the dotted path representation of the Chef attribute and value
50 51 52 53 |
# File 'lib/ridley/resources/environment_resource.rb', line 50 def set_default_attribute(key, value) attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value) self.default_attributes = self.default_attributes.deep_merge(attr_hash) end |
#set_override_attribute(key, value) ⇒ HashWithIndifferentAccess
Set an environment level override attribute given the dotted path representation of the Chef attribute and value
68 69 70 71 |
# File 'lib/ridley/resources/environment_resource.rb', line 68 def set_override_attribute(key, value) attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value) self.override_attributes = self.override_attributes.deep_merge(attr_hash) end |