aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-10-21 00:10:28 +0200
committerMicah Anderson <micah@riseup.net>2010-11-07 13:37:21 -0500
commit2dd17923bf6787029aee00d0b0e1e8dfbb0a5e7f (patch)
treefa8eccbae6b2d936aafec8f343da491bcda106a9 /lib/puppet/parser
parent90a172d01f13924954384229655b5098db0cbb73 (diff)
downloadpuppet-common-2dd17923bf6787029aee00d0b0e1e8dfbb0a5e7f.tar.gz
puppet-common-2dd17923bf6787029aee00d0b0e1e8dfbb0a5e7f.tar.bz2
add a join function
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/functions/join.rb10
1 files changed, 10 insertions, 0 deletions
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