summaryrefslogtreecommitdiff
path: root/lib/chef/mixin
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-01-31 18:22:29 +0000
committerThom May <thom@chef.io>2018-02-12 17:36:12 +0000
commitd3031263eb7c5a31e8f20b4b54d33d184345ae45 (patch)
tree00f02c928cb240b9ee1be8b65e2fe19f823dad94 /lib/chef/mixin
parenta7d56100275045ad44e57386aad86e463788ee85 (diff)
downloadchef-d3031263eb7c5a31e8f20b4b54d33d184345ae45.tar.gz
properties can have descriptions
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r--lib/chef/mixin/properties.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb
index 8ff2cc4501..bb08f773da 100644
--- a/lib/chef/mixin/properties.rb
+++ b/lib/chef/mixin/properties.rb
@@ -75,6 +75,7 @@ class Chef
# will return if the user does not set one. If this is `lazy`, it will
# be run in the context of the instance (and able to access other
# properties).
+ # @option options [String] :description A description of the property.
# @option options [Boolean] :desired_state `true` if this property is
# part of desired state. Defaults to `true`.
# @option options [Boolean] :identity `true` if this property
@@ -301,6 +302,17 @@ class Chef
raise ArgumentError, "Property #{name} is not defined in class #{self}" if !property
property.reset(self)
end
+
+ #
+ # The description of the property
+ #
+ # @param name [Symbol] The name of the property.
+ # @return [String] The description of the property.
+ def property_description(name)
+ property = self.class.properties[name.to_sym]
+ raise ArgumentError, "Property #{name} is not defined in class #{self}" if !property
+ property.description
+ end
end
end
end