summaryrefslogtreecommitdiff
path: root/lib/chef/resource.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r--lib/chef/resource.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 1791e4143e..b3c3fd4429 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -1461,6 +1461,19 @@ class Chef
end
end
+ # Apply a proc or block to the resource.
+ #
+ # modes = proc { mode "0644"; group "root"; owner "root" }
+ # file "/tmp/whatever" do
+ # apply modes
+ # end
+ #
+ # @method apply(proc, &block)
+ def apply(prok=nil, &block)
+ block ||= prok
+ self.instance_eval(&block)
+ end
+
#
# Preface an exception message with generic Resource information.
#