From ce48eb6e7a76f74e1f61c76ac3b185031c40772b Mon Sep 17 00:00:00 2001
From: Ken Barber <ken@bob.sh>
Date: Fri, 29 Jul 2011 00:10:31 +0100
Subject: Allow sort for strings.

---
 lib/puppet/parser/functions/sort.rb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'lib')

diff --git a/lib/puppet/parser/functions/sort.rb b/lib/puppet/parser/functions/sort.rb
index 54a4018..49ca20a 100644
--- a/lib/puppet/parser/functions/sort.rb
+++ b/lib/puppet/parser/functions/sort.rb
@@ -12,7 +12,13 @@ module Puppet::Parser::Functions
         "given #{arguments.size} for 1")
     end
 
-    arguments[0].sort
+    value = arguments[0]
+
+    if value.is_a?(Array) then
+      value.sort
+    elsif value.is_a?(String) then
+      value.split("").sort.to_s
+    end
 
   end
 end
-- 
cgit v1.2.3