diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-28 21:36:28 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-28 21:39:45 -0700 |
commit | 51296dde0d9c0731d05a1e7f1fba1bbf9036b14b (patch) | |
tree | e193a032e67ccef9264b5818b37bd8254cbae3e6 /lib/chef/resource.rb | |
parent | f343740fbd93812ed9b247b8a7752372ee0ae1fc (diff) | |
download | chef-documentation_enhancements.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.rb')
-rw-r--r-- | lib/chef/resource.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 5222dc7286..c857d76c02 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -131,6 +131,7 @@ class Chef @only_if = [] @source_line = nil @deprecated = false + @skip_docs = false # We would like to raise an error when the user gives us a guard # interpreter and a ruby_block to the guard. In order to achieve this # we need to understand when the user overrides the default guard @@ -1183,8 +1184,8 @@ class Chef # Internal Resource Interface (for Chef) # - FORBIDDEN_IVARS = [:@run_context, :@logger, :@not_if, :@only_if, :@enclosing_provider, :@description, :@introduced, :@examples, :@validation_message, :@deprecated].freeze - HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@logger, :@name, :@not_if, :@only_if, :@elapsed_time, :@enclosing_provider, :@description, :@introduced, :@examples, :@validation_message, :@deprecated].freeze + FORBIDDEN_IVARS = [:@run_context, :@logger, :@not_if, :@only_if, :@enclosing_provider, :@description, :@introduced, :@examples, :@validation_message, :@deprecated, :@default_description, :@skip_docs].freeze + HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@logger, :@name, :@not_if, :@only_if, :@elapsed_time, :@enclosing_provider, :@description, :@introduced, :@examples, :@validation_message, :@deprecated, :@default_description, :@skip_docs].freeze include Chef::Mixin::ConvertToClassName extend Chef::Mixin::ConvertToClassName @@ -1448,6 +1449,20 @@ class Chef @deprecated end + def self.skip_docs(skip_docs = "NOT_PASSED") + if skip_docs != "NOT_PASSED" + @skip_docs = skip_docs + end + @skip_docs + end + + def self.default_description(default_description = "NOT_PASSED") + if default_description != "NOT_PASSED" + @default_description = default_description + end + @default_description + end + # # The cookbook in which this Resource was defined (if any). # |