From: mh Date: Wed, 20 Oct 2010 22:10:28 +0000 (+0200) Subject: add a join function X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=2dd17923bf6787029aee00d0b0e1e8dfbb0a5e7f;p=puppet-common.git add a join function --- diff --git a/lib/puppet/parser/functions/join.rb b/lib/puppet/parser/functions/join.rb new file mode 100644 index 0000000..95b664c --- /dev/null +++ b/lib/puppet/parser/functions/join.rb @@ -0,0 +1,10 @@ +Puppet::Parser::Functions::newfunction( + :join, + :type => :rvalue, + :doc => "Joins the values of the array in arg1 with the string in arg2 + + Example: join(['a','b'],',') -> 'a,b'" +) do |args| + raise Puppet::ParseError, 'join() needs two arguments' if args.length != 2 + args[0].to_a.join(args[1]) +end