Class: Chef::Mixin::ParamsValidate::SetOrReturnProperty Private
- Defined in:
- lib/chef/mixin/params_validate.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Used by #set_or_return to avoid emitting a deprecation warning for “value nil” and to keep default stickiness working exactly the same
Instance Method Summary collapse
- #call(resource, value = NOT_PASSED) ⇒ Object private
- #get(resource) ⇒ Object private
Methods inherited from Property
#coerce, #declared_in, #default, derive, #derive, #desired_state?, #emit_dsl, #has_default?, #identity?, #initialize, #instance_variable_name, #is_set?, #name, #name_property?, #required?, #reset, #set, #to_s, #validate, #validation_options
Constructor Details
This class inherits a constructor from Chef::Property
Instance Method Details
#call(resource, value = NOT_PASSED) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
478 479 480 481 482 483 484 485 |
# File 'lib/chef/mixin/params_validate.rb', line 478 def call(resource, value = NOT_PASSED) # setting to nil does a get if value.nil? && !explicitly_accepts_nil?(resource) get(resource) else super end end |
#get(resource) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
469 470 471 472 473 474 475 476 |
# File 'lib/chef/mixin/params_validate.rb', line 469 def get(resource) value = super # All values are sticky, frozen or not if !is_set?(resource) set_value(resource, value) end value end |