Method: Chef::Resource#identity
- Defined in:
- lib/chef/resource.rb
#identity ⇒ Object, Hash<Symbol,Object>
The value of the identity of this resource.
-
If there are no identity properties on the resource,
nameis returned. -
If there is exactly one identity property on the resource, it is returned.
-
If there are more than one, they are returned in a hash.
526 527 528 529 530 531 532 533 534 535 |
# File 'lib/chef/resource.rb', line 526 def identity result = {} identity_properties = self.class.identity_properties identity_properties.each do |property| result[property.name] = send(property.name) end return result.values.first if identity_properties.size == 1 result end |