Module: Chef::Mixin::Properties

Includes:
ParamsValidate
Included in:
Resource
Defined in:
lib/chef/mixin/properties.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ParamsValidate

#lazy, #set_or_return, #validate

Class Method Details

.included(other) ⇒ Object



270
271
272
# File 'lib/chef/mixin/properties.rb', line 270

def self.included(other)
  other.extend ClassMethods
end

Instance Method Details

#property_is_set?(name) ⇒ Boolean

Whether this property has been set (or whether it has a default that has been retrieved).

Parameters:

  • name (Symbol)

    The name of the property.

Returns:

  • (Boolean)

    ‘true` if the property has been set.

Raises:

  • (ArgumentError)


283
284
285
286
287
# File 'lib/chef/mixin/properties.rb', line 283

def property_is_set?(name)
  property = self.class.properties[name.to_sym]
  raise ArgumentError, "Property #{name} is not defined in class #{self}" if !property
  property.is_set?(self)
end

#reset_property(name) ⇒ Object

Clear this property as if it had never been set. It will thereafter return the default. been retrieved).

Parameters:

  • name (Symbol)

    The name of the property.

Raises:

  • (ArgumentError)


296
297
298
299
300
# File 'lib/chef/mixin/properties.rb', line 296

def reset_property(name)
  property = self.class.properties[name.to_sym]
  raise ArgumentError, "Property #{name} is not defined in class #{self}" if !property
  property.reset(self)
end