From d2c178b59c7c1186aacb1feefab113eba7c6c1cc Mon Sep 17 00:00:00 2001 From: Ian Kronquist Date: Mon, 14 Sep 2015 15:14:31 -0700 Subject: [PATCH] (PDOC-52) Register docstring after object In a Puppet type if the user documents a parameter with the directive, then Yard will read the parameter and think there is an empty docstring there. This will overwrite the docstring we extracted. The fix is simple -- overwrite our docstring with theirs, if our docstring exists at all. --- .../puppetlabs/strings/yard/handlers/type_handler.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb b/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb index d146e6f..06c7d34 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/handlers/type_handler.rb @@ -138,9 +138,12 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::PuppetTypeHandler < YARD::Ha obj.property_details = property_details obj.features = features - register_docstring(obj, docstring, nil) - register obj + # Register docstring after the object. If the object already has a + # docstring, or more likely has parameters documented with the type + # directive and an empty docstring, we want to override it with the + # docstring we found, assuming we found one. + register_docstring(obj, docstring, nil) if docstring end