From 3ff12051c8efabcdfb43b99810ff1c2ea22750a3 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 23 Nov 2009 11:54:04 -0500 Subject: move plugin directory to fit new 0.25.x style and update file paths accordingly --- lib/puppet/parser/functions/prefix_with.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/puppet/parser/functions/prefix_with.rb (limited to 'lib/puppet/parser/functions/prefix_with.rb') diff --git a/lib/puppet/parser/functions/prefix_with.rb b/lib/puppet/parser/functions/prefix_with.rb new file mode 100644 index 0000000..5a12986 --- /dev/null +++ b/lib/puppet/parser/functions/prefix_with.rb @@ -0,0 +1,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 + -- cgit v1.2.3