Mercurial > repos > other > Puppet
diff modules/stdlib/lib/puppet/parser/functions/any2array.rb @ 478:adf6fe9bbc17
Update Puppet modules to latest versions
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 29 Aug 2024 18:47:29 +0100 |
parents | d9352a684e62 |
children |
line wrap: on
line diff
--- a/modules/stdlib/lib/puppet/parser/functions/any2array.rb Tue Aug 27 13:35:17 2024 +0100 +++ b/modules/stdlib/lib/puppet/parser/functions/any2array.rb Thu Aug 29 18:47:29 2024 +0100 @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # # any2array.rb # module Puppet::Parser::Functions - newfunction(:any2array, :type => :rvalue, :doc => <<-DOC + newfunction(:any2array, type: :rvalue, doc: <<-DOC @summary This converts any object to an array containing that object. @@ -33,15 +35,13 @@ @return [Array] The new array containing the given object DOC - ) do |arguments| - - if arguments.empty? - return [] - end + ) do |arguments| + return [] if arguments.empty? return arguments unless arguments.length == 1 return arguments[0] if arguments[0].is_a?(Array) return [] if arguments == [''] + if arguments[0].is_a?(Hash) result = [] arguments[0].each do |key, value|