aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoro <o@immerda.ch>2014-04-16 14:21:32 +0200
committero <o@immerda.ch>2014-04-16 14:21:32 +0200
commit4b4744e402f5cbc5f9856971d1a64002c7eb0796 (patch)
tree869fb526fdc621e65ddd8ba9c185ffdc08a2af85
parent47c385f4794fae0257dd3ab85b637eca93ee38ec (diff)
downloadpuppet-common-4b4744e402f5cbc5f9856971d1a64002c7eb0796.tar.gz
puppet-common-4b4744e402f5cbc5f9856971d1a64002c7eb0796.tar.bz2
add an array_join function
-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