diff options
author | o <o@immerda.ch> | 2014-04-16 14:21:32 +0200 |
---|---|---|
committer | o <o@immerda.ch> | 2014-04-16 14:21:32 +0200 |
commit | 4b4744e402f5cbc5f9856971d1a64002c7eb0796 (patch) | |
tree | 869fb526fdc621e65ddd8ba9c185ffdc08a2af85 | |
parent | 47c385f4794fae0257dd3ab85b637eca93ee38ec (diff) | |
download | puppet-common-4b4744e402f5cbc5f9856971d1a64002c7eb0796.tar.gz puppet-common-4b4744e402f5cbc5f9856971d1a64002c7eb0796.tar.bz2 |
add an array_join function
-rw-r--r-- | lib/puppet/parser/functions/array_join.rb | 8 |
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 |