aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/functions/array_join.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/array_join.rb b/lib/puppet/parser/functions/array_join.rb
new file mode 100644
index 0000000..c715c5d
--- /dev/null
+++ b/lib/puppet/parser/functions/array_join.rb
@@ -0,0 +1,8 @@
+Puppet::Parser::Functions::newfunction(:array_join,
+ :type => :rvalue,
+ :doc => "Join a list of strings with an optional delimiter.") do |args|
+ unless 1..2.include? args.length
+ raise Puppet::ParseError, 'array_join() takes 1 or 2 arguments'
+ end
+ args.first.join args.last
+end