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.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index ea220b6c70..2df73a52e8 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -997,6 +997,15 @@ class Chef
end
#
+ # DSL method used to define attribute on a resource wrapping params_validate
+ #
+ def self.attribute(attr_name, validation_opts={})
+ define_method(attr_name) do |arg=NULL_ARG|
+ nillable_set_or_return(attr_name.to_sym, arg, validation_opts)
+ end
+ end
+
+ #
# The cookbook in which this Resource was defined (if any).
#
# @return Chef::CookbookVersion The cookbook in which this Resource was defined.