module Garcon::Resource::LazyEval

Resource mixin to allow lazyily-evaluated defaults in resource attributes.

Public Instance Methods

set_or_return(symbol, arg, validation) click to toggle source

Override the default set_or_return to support lazy evaluation of the default value. This only actually matters when it is called from a class level context via attributes.

Calls superclass method
# File lib/garcon/chef/resource/lazy_eval.rb, line 57
def set_or_return(symbol, arg, validation)
  if validation && validation[:default].is_a?(Chef::DelayedEvaluator)
    validation = validation.dup
    validation[:default] = instance_eval(&validation[:default])
  end
  super(symbol, arg, validation)
end