aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/prefix_with.rb
blob: 5a12986cdf8e1c55cfe6e3f986a1021744694754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Prefixes arguments 2..n with first argument.
#
#  prefix_with(string prefix, string[] arguments) : string[]
#
# Example:
#
#  prefix_with("php-", [ "blah", "foo" ])
#
# will result in this array:
#
#  [ "php-blah", "php-foo" ]
#
module Puppet::Parser::Functions
	newfunction(:prefix_with, :type => :rvalue) do |args|
		prefix = args.shift
		args.collect {|v| "%s%s" % [prefix, v] }
	end
end