]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
First version. Adding join to Puppet for use within the manifest files.
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Sat, 23 Apr 2011 15:43:11 +0000 (16:43 +0100)
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Sat, 23 Apr 2011 15:43:11 +0000 (16:43 +0100)
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
join.rb [new file with mode: 0644]

diff --git a/join.rb b/join.rb
new file mode 100644 (file)
index 0000000..b616e05
--- /dev/null
+++ b/join.rb
@@ -0,0 +1,25 @@
+#
+# join.rb
+#
+
+module Puppet::Parser::Functions
+  newfunction(:join, :type => :rvalue, :doc => <<-EOS
+    EOS
+  ) do |arguments|
+
+    array = arguments[0]
+
+    suffix = arguments[1]
+    prefix = arguments[2]
+
+    if prefix and not prefix.empty?
+      result = prefix + array.join(suffix + prefix)
+    else
+      result = array.join(suffix)
+    end
+
+    return result
+  end
+end
+
+# vim: set ts=2 sw=2 et :