From 849c731511615cb9e6b6eca83f05a774415f2825 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Tue, 17 Feb 2015 11:28:26 -0800 Subject: [PATCH] (PDOC-27) Make fix compatible with Ruby 2x Prior to this commit, the fix for the 3x function issue was trying to create an empty hash by calling Hash[ [[]] ] which in Ruby 1.9.3 produced and empty hash. However this is not the case in Ruby 2.0 and up. Therefor, fix up the code so that it does not rely on Hash[ [[]] ] creating and empty hash. --- .../strings/yard/handlers/puppet_3x_function_handler.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb b/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb index 1e1cea2..7ae9bd3 100644 --- a/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb +++ b/lib/puppet_x/puppetlabs/strings/yard/handlers/puppet_3x_function_handler.rb @@ -73,11 +73,13 @@ class PuppetX::PuppetLabs::Strings::YARD::Handlers::Puppet3xFunctionHandler < YA # and the values on either side of it. tuple.jump(:assoc).map{|e| process_element(e)} end + + options = Hash[opts] else - opts = [[]] + options = {} end - [name, Hash[opts]] + [name, options] end # Sometimes the YARD parser returns Heredoc strings that start with `<-`