Class: Ridley::EnvironmentObject

Inherits:
ChefObject show all
Defined in:
lib/ridley/chef_objects/environment_object.rb

Instance Method Summary collapse

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) ⇒ HashWithIndifferentAccess

Set an environment level default attribute given the dotted path representation of the Chef attribute and value

Examples:

setting and saving an environment level default attribute


obj = environment.find("production")
obj.set_default_attribute("my_app.billing.enabled", false)
obj.save

Parameters:

  • key (String)
  • value (Object)

Returns:

  • (HashWithIndifferentAccess)


35
36
37
38
# File 'lib/ridley/chef_objects/environment_object.rb', line 35

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

Examples:

setting and saving an environment level override attribute


obj = environment.find("production")
obj.set_override_attribute("my_app.billing.enabled", false)
obj.save

Parameters:

  • key (String)
  • value (Object)

Returns:

  • (HashWithIndifferentAccess)


53
54
55
56
# File 'lib/ridley/chef_objects/environment_object.rb', line 53

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