add an array_join function
This commit is contained in:
parent
47c385f479
commit
4b4744e402
1 changed files with 8 additions and 0 deletions
8
lib/puppet/parser/functions/array_join.rb
Normal file
8
lib/puppet/parser/functions/array_join.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue