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



273
274
275
# File 'lib/chef/mixin/properties.rb', line 273

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)


286
287
288
289
290
# File 'lib/chef/mixin/properties.rb', line 286

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)


299
300
301
302
303
# File 'lib/chef/mixin/properties.rb', line 299

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