From fc2779202c2f97a4498fa2a415cba5265c8433e1 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 2 Mar 2017 14:49:04 +0100 Subject: [PATCH] Fix args handling for rake strings::generate In the rake task strings::generate, the arguments json and yard_args are not applied properly. The logic uses args.key?, however args is not a Hash but a Rake::TaskArguments (and Enumerable). There is now key? method. Use Rake::TaskArguments.has_key? instead. --- lib/puppet-strings/tasks/generate.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/puppet-strings/tasks/generate.rb b/lib/puppet-strings/tasks/generate.rb index 616deda..91a931c 100644 --- a/lib/puppet-strings/tasks/generate.rb +++ b/lib/puppet-strings/tasks/generate.rb @@ -14,8 +14,11 @@ namespace :strings do markup: args[:markup] || 'markdown', } - options[:json] = args[:json] if args.key? :json - options[:yard_args] = args[:yard_args].split if args.key? :yard_args + # rubocop:disable Style/PreferredHashMethods + # `args` is a Rake::TaskArguments and has no key? method + options[:json] = args[:json] if args.has_key? :json + options[:yard_args] = args[:yard_args].split if args.has_key? :yard_args + # rubocop:enable Style/PreferredHashMethods PuppetStrings.generate(patterns, options) end