Mercurial > repos > other > Puppet
diff modules/stdlib/lib/puppet/parser/functions/glob.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/glob.rb Tue Aug 27 13:35:17 2024 +0100 +++ b/modules/stdlib/lib/puppet/parser/functions/glob.rb Thu Aug 29 18:47:29 2024 +0100 @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # # glob.rb # module Puppet::Parser::Functions - newfunction(:glob, :type => :rvalue, :doc => <<-DOC + newfunction(:glob, type: :rvalue, doc: <<-DOC @summary Uses same patterns as Dir#glob. @@ -11,19 +13,18 @@ @example Example Usage: $confs = glob(['/etc/**/*.conf', '/opt/**/*.conf']) - DOC - ) do |arguments| - + DOC + ) do |arguments| unless arguments.size == 1 raise(Puppet::ParseError, 'glob(): Wrong number of arguments given ' \ - "(#{arguments.size} for 1)") + "(#{arguments.size} for 1)") end pattern = arguments[0] unless pattern.is_a?(String) || pattern.is_a?(Array) raise(Puppet::ParseError, 'glob(): Requires either array or string ' \ - 'to work') + 'to work') end Dir.glob(pattern)