]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Now prefix will convert everything into string which is the same
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Sat, 30 Apr 2011 01:40:04 +0000 (02:40 +0100)
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Sat, 30 Apr 2011 01:40:04 +0000 (02:40 +0100)
as join would do.  Also function is now more robust in error detection.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
prefix.rb

index 572ff4e0538615c4d1f1b29a4db4d89fb9f548ab..0e0cee2b4e46281a01731593fa68d089d3a9dbe6 100644 (file)
--- a/prefix.rb
+++ b/prefix.rb
@@ -19,11 +19,20 @@ module Puppet::Parser::Functions
 
     prefix = arguments[1] if arguments[1]
 
-    result = array.collect { |i| prefix ? prefix + i : i }
+    if prefix
+      unless prefix.is_a?(String)
+        raise(Puppet::ParseError, 'prefix(): Requires string to work with')
+      end
+    end
+
+    # Turn everything into string same as join would do ...
+    result = array.collect do |i|
+      i = i.to_s
+      prefix ? prefix + i : i
+    end
 
     return result
   end
 end
 
 # vim: set ts=2 sw=2 et :
-