From 7f4b81e77ba6ab5f5a854e68e0daf02d7173379b Mon Sep 17 00:00:00 2001 From: Ian Kronquist Date: Mon, 14 Sep 2015 15:17:23 -0700 Subject: [PATCH] (PDOC-53) Handle directives with no types Parameter directives with no types will have `tag.type` set to nil. We cannot append nil to an array, so instead, place it in the array and flatten the array. If the property is empty the second entry in the array will be nil, as we expect. If the `tag.type` is an array of types we will have and array with the form: [tag.text, type1, type2, type3, ...] --- lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb b/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb index dcb60e0..0b94793 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/tags/directives.rb @@ -3,7 +3,7 @@ require 'puppet_x/puppetlabs/strings/yard/core_ext/yard' class PuppetX::PuppetLabs::Strings::YARD::Tags::PuppetTypeParameterDirective < YARD::Tags::Directive def call return if object.nil? - object.parameters << ([tag.text] + tag.types) + object.parameters << ([tag.text, tag.types].flatten) object.parameter_details << {:name => tag.name, :desc => tag.text, :exists? => true, :puppet_type => true} end end