diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-28 21:36:28 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-30 16:18:46 -0700 |
commit | bcbb7e14a31769630552e3979dad7d5941d2277c (patch) | |
tree | e367fa6892ec84492d7b07ebee2f3c1ad42bf3df /lib/chef/resource.rb | |
parent | f67d152a8bd569d2aac5b034962a7982d2ba5b26 (diff) | |
download | chef-docs_improvements.tar.gz |
Add skip_docs and default_description to resource propertiesdocs_improvements
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). # |