Class: Ridley::EnvironmentObject
- Inherits:
-
ChefObject
- Object
- ChefObject
- Ridley::EnvironmentObject
- Defined in:
- lib/ridley/chef_objects/environment_object.rb
Instance Method Summary collapse
-
#set_default_attribute(key, value) ⇒ Hashie::Mash
Set an environment level default attribute given the dotted path representation of the Chef attribute and value.
-
#set_override_attribute(key, value) ⇒ Hashie::Mash
Set an environment level override attribute given the dotted path representation of the Chef attribute and value.
-
#unset_default_attribute(key) ⇒ Hashie::Mash
(also: #delete_default_attribute)
Removes a environment default attribute given its dotted path representation.
-
#unset_override_attribute(key) ⇒ Hashie::Mash
(also: #delete_override_attribute)
Removes a environment override attribute given its dotted path representation.
Methods inherited from ChefObject
#<=>, #==, chef_id, #chef_id, chef_json_class, chef_type, #eql?, #hash, #initialize, #inspect, #reload, #save, set_chef_id, set_chef_json_class, set_chef_type, #update
Constructor Details
This class inherits a constructor from Ridley::ChefObject
Instance Method Details
#set_default_attribute(key, value) ⇒ Hashie::Mash
Set an environment level default attribute given the dotted path representation of the Chef attribute and value
35 36 37 38 |
# File 'lib/ridley/chef_objects/environment_object.rb', line 35 def set_default_attribute(key, value) attr_hash = Hashie::Mash.from_dotted_path(key, value) self.default_attributes = self.default_attributes.deep_merge(attr_hash) end |
#set_override_attribute(key, value) ⇒ Hashie::Mash
Set an environment level override attribute given the dotted path representation of the Chef attribute and value
53 54 55 56 |
# File 'lib/ridley/chef_objects/environment_object.rb', line 53 def set_override_attribute(key, value) attr_hash = Hashie::Mash.from_dotted_path(key, value) self.override_attributes = self.override_attributes.deep_merge(attr_hash) end |
#unset_default_attribute(key) ⇒ Hashie::Mash Also known as: delete_default_attribute
Removes a environment default attribute given its dotted path representation. Returns the default attributes of the environment.
65 66 67 |
# File 'lib/ridley/chef_objects/environment_object.rb', line 65 def unset_default_attribute(key) unset_attribute(key, :default) end |
#unset_override_attribute(key) ⇒ Hashie::Mash Also known as: delete_override_attribute
Removes a environment override attribute given its dotted path representation. Returns the override attributes of the environment.
77 78 79 |
# File 'lib/ridley/chef_objects/environment_object.rb', line 77 def unset_override_attribute(key) unset_attribute(key, :override) end |