From 4ff7fabb70a0b83e343ce444931e645bac22c7c1 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Thu, 23 May 2013 15:06:39 +0000 Subject: Add str_join function A function to join elements from an array to create a string. --- modules/mga-common/lib/puppet/parser/functions/str_join.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 modules/mga-common/lib/puppet/parser/functions/str_join.rb (limited to 'modules/mga-common/lib') diff --git a/modules/mga-common/lib/puppet/parser/functions/str_join.rb b/modules/mga-common/lib/puppet/parser/functions/str_join.rb new file mode 100644 index 00000000..de97bfb5 --- /dev/null +++ b/modules/mga-common/lib/puppet/parser/functions/str_join.rb @@ -0,0 +1,11 @@ +# str_join($array, $sep) +# -> return a string created by converting each element of the array to +# a string, separated by $sep + +module Puppet::Parser::Functions + newfunction(:str_join, :type => :rvalue) do |args| + array = args[0] + sep = args[1] + return array.join(sep) + end +end -- cgit v1.2.1