summaryrefslogtreecommitdiff
path: root/lib/chef/resource_inspector.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-28 21:36:28 -0700
committerTim Smith <tsmith@chef.io>2018-10-28 21:39:45 -0700
commit51296dde0d9c0731d05a1e7f1fba1bbf9036b14b (patch)
treee193a032e67ccef9264b5818b37bd8254cbae3e6 /lib/chef/resource_inspector.rb
parentf343740fbd93812ed9b247b8a7752372ee0ae1fc (diff)
downloadchef-51296dde0d9c0731d05a1e7f1fba1bbf9036b14b.tar.gz
Add skip_docs and default_description to resource propertiesdocumentation_enhancements
skip_docs is used to specify a property that we don't want to include in the documentation. We have several of these. default_description is used to describe the default in a way we'd want to put on the docs site. This is particularly useful for describing all our lazy / computed values. I've used both of these in resources to show how I think we'll use them. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource_inspector.rb')
-rw-r--r--lib/chef/resource_inspector.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource_inspector.rb b/lib/chef/resource_inspector.rb
index 7363aad2a6..1a49f05b72 100644
--- a/lib/chef/resource_inspector.rb
+++ b/lib/chef/resource_inspector.rb
@@ -46,9 +46,9 @@ module ResourceInspector
data[:preview] = resource.preview_resource
properties = unless complete
- resource.properties.reject { |_, k| k.options[:declared_in] == Chef::Resource }
+ resource.properties.reject { |_, k| k.options[:declared_in] == Chef::Resource || k.options[:skip_docs] }
else
- resource.properties
+ resource.properties.reject { |_, k| k.options[:skip_docs] }
end
data[:properties] = properties.each_with_object([]) do |(n, k), acc|
@@ -57,7 +57,7 @@ module ResourceInspector
introduced: opts[:introduced], is: opts[:is],
deprecated: opts[:deprecated] || false,
required: opts[:required] || false,
- default: get_default(opts[:default]),
+ default: opts[:default_description] || get_default(opts[:default]),
name_property: opts[:name_property] || false }
end
data