create a common class to install openssl
[module-common] / plugins / puppet / parser / functions / gsub.rb
1 module Puppet::Parser::Functions
2         # thin wrapper around the ruby gsub function
3         # gsub($string, $pattern, $replacement) will replace all occurrences of
4         # $pattern in $string with $replacement. $string can be either a singel
5         # value or an array. In the latter case, each element of the array will
6         # be processed in turn.
7         newfunction(:gsub, :type => :rvalue) do |args|
8                 if args[0].is_a?(Array)
9                         args[0].collect do |val|
10                                 val.gsub(/#{args[1]}/, args[2])
11                         end
12                 else
13                         args[0].gsub(/#{args[1]}/, args[2])
14                 end
15         end
16 end
17