From 2dd17923bf6787029aee00d0b0e1e8dfbb0a5e7f Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 21 Oct 2010 00:10:28 +0200 Subject: add a join function --- lib/puppet/parser/functions/join.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/puppet/parser/functions/join.rb (limited to 'lib/puppet/parser') 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 -- cgit v1.2.3