From a2ddd1133c57f7ae25cdebd0eb860bb8c3b148ad Mon Sep 17 00:00:00 2001 From: John Keiser Date: Wed, 3 Jun 2015 16:01:07 -0700 Subject: Add lazy to Resource class DSL --- lib/chef/resource.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/chef/resource.rb') diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index cbab5e9c27..44247ca9f0 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -792,6 +792,17 @@ class Chef end end + # + # Create a lazy value for assignment to a default value. + # + # @param block The block to run when the value is retrieved. + # + # @return [Chef::DelayedEvaluator] The lazy value + # + def self.lazy(&block) + DelayedEvaluator.new(&block) + end + # Set or return the list of "state attributes" implemented by the Resource # subclass. State attributes are attributes that describe the desired state # of the system, such as file permissions or ownership. In general, state -- cgit v1.2.1