From 7cd63a177cfccc7e7bba3aae931c9d14ddd3bf23 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Tue, 2 Jun 2009 19:22:03 +0200 Subject: Reenable gsub, since regsubst is no proper replacement --- plugins/puppet/parser/functions/gsub.rb | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 plugins/puppet/parser/functions/gsub.rb (limited to 'plugins') diff --git a/plugins/puppet/parser/functions/gsub.rb b/plugins/puppet/parser/functions/gsub.rb new file mode 100644 index 0000000..a85fd70 --- /dev/null +++ b/plugins/puppet/parser/functions/gsub.rb @@ -0,0 +1,69 @@ + + + + + + + + + +git.black.co.at Git - module-common/blob - plugins/puppet/parser/functions/gsub.rb + + + + + + + + + +
+ +
+ +
+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
+ +
+ + \ No newline at end of file -- cgit v1.2.3