# File 'lib/chef/mixin/properties.rb', line 239defidentity_properties(*names)if!names.empty?names=names.map{|name|name.to_sym}# Add or change properties that are not part of the identity.
names.eachdo|name|property=properties[name]if!propertyself.propertyname,instance_variable_name:false,identity:trueelsif!property.identity?self.propertyname,identity:trueendend# If identity_properties *excludes* something which is currently part of
# the identity, mark it as identity: false.
properties.eachdo|name,property|ifproperty.identity?&&!names.include?(name)self.propertyname,identity:falseendendendresult=properties.values.select{|property|property.identity?}result=[properties[:name]]ifresult.empty?resultend

Validation options.
@option options [Object,Array] :is An object, or list of
objects, that must match the value using Ruby's === operator
(options[:is].any? { |v| v === value }).
@option options [Object,Array] :equal_to An object, or list
of objects, that must be equal to the value using Ruby's ==
operator (options[:is].any? { |v| v == value })
@option options [Regexp,Array] :regex An object, or
list of objects, that must match the value with regex.match(value).
@option options [Class,Array] :kind_of A class, or
list of classes, that the value must be an instance of.
@option options [Hash] :callbacks A hash of
messages -> procs, all of which match the value. The proc must
return a truthy or falsey value (true means it matches).
@option options [Symbol,Array] :respond_to A method
name, or list of method names, the value must respond to.
@option options [Symbol,Array] :cannot_be A property,
or a list of properties, that the value cannot have (such as :nil or
:empty). The method with a questionmark at the end is called on the
value (e.g. value.empty?). If the value does not have this method,
it is considered valid (i.e. if you don't respond to empty? we
assume you are not empty).
@option options [Proc] :coerce A proc which will be called to
transform the user input to canonical form. The value is passed in,
and the transformed value returned as output. Lazy values will not
be passed to this method until after they are evaluated. Called in the
context of the resource (meaning you can access other properties).
@option options [Boolean] :required true if this property
must be present; false otherwise. This is checked after the resource
is fully initialized.
@option options [Boolean] :name_property true if this
property defaults to the same value as name. Equivalent to
default: lazy { name }, except that #property_is_set? will
return true if the property is set or if name is set.
@option options [Boolean] :name_attribute Same as name_property.
@option options [Object] :default The value this property
will return if the user does not set one. If this is lazy, it will
be run in the context of the instance (and able to access other
properties).
@option options [Boolean] :desired_state true if this property is
part of desired state. Defaults to true.
@option options [Boolean] :identity true if this property
is part of object identity. Defaults to false.
@option options [Boolean] :sensitive true if this property could
contain sensitive information and whose value should be redacted
in any resource reporting / auditing output. Defaults to false.

# File 'lib/chef/mixin/properties.rb', line 98defproperty(name,type=NOT_PASSED,**options)name=name.to_symoptions=options.inject({}){|memo,(key,value)|memo[key.to_sym]=value;memo}options[:instance_variable_name]=:"@#{name}"if!options.has_key?(:instance_variable_name)options[:name]=nameoptions[:declared_in]=selfiftype==NOT_PASSED# If a type is not passed, the property derives from the
# superclass property (if any)
ifproperties.has_key?(name)property=properties[name].derive(**options)elseproperty=property_type(**options)end# If a Property is specified, derive a new one from that.
elsiftype.is_a?(Property)||(type.is_a?(Class)&&type<=Property)property=type.derive(**options)# If a primitive type was passed, combine it with "is"
elseifoptions[:is]options[:is]=([type]+[options[:is]]).flatten(1)elseoptions[:is]=typeendproperty=property_type(**options)endlocal_properties=properties(false)local_properties[name]=propertyproperty.emit_dslend

#property_type(**options) ⇒ Object

Create a reusable property type that can be used in multiple properties
in different resources.

State properties are properties that describe the desired state
of the system, such as file permissions or ownership.
In general, state properties are properties that could be populated by
examining the state of the system (e.g., File.stat can tell you the
permissions on an existing file). Contrarily, properties that are not
"state properties" usually modify the way Chef itself behaves, for example
by providing additional options for a package manager to use when
installing a package.

This list is used by the Chef client auditing system to extract
information from resources to describe changes made to the system.

This method is unnecessary when declaring properties with property;
properties are added to state_properties by default, and can be turned off
with desired_state: false.

property:x# part of desired state
property:y,desired_state:false# not part of desired state

# File 'lib/chef/mixin/properties.rb', line 190defstate_properties(*names)if!names.empty?names=names.map{|name|name.to_sym}.uniqlocal_properties=properties(false)# Add new properties to the list.
names.eachdo|name|property=properties[name]if!propertyself.propertyname,instance_variable_name:false,desired_state:trueelsif!property.desired_state?self.propertyname,desired_state:trueendend# If state_attrs *excludes* something which is currently desired state,
# mark it as desired_state: false.
local_properties.eachdo|name,property|ifproperty.desired_state?&&!names.include?(name)self.propertyname,desired_state:falseendendendproperties.values.select{|property|property.desired_state?}end