]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Added FalseClass and TrueClass to be identified as Boolean to the type function.
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Fri, 29 Apr 2011 19:05:44 +0000 (20:05 +0100)
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Fri, 29 Apr 2011 19:05:44 +0000 (20:05 +0100)
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
type.rb

diff --git a/type.rb b/type.rb
index 389a0562b1c810d73d48945c8c682bb357b05cda..ac1895c064e95f1d89319e9d6f657ffdc277b9e2 100644 (file)
--- a/type.rb
+++ b/type.rb
@@ -14,15 +14,21 @@ module Puppet::Parser::Functions
 
     klass = value.class
 
-    if not [Array, Bignum, Fixnum, Float, Hash, String].include?(klass)
+    if not [Array, Bignum, Fixnum, FalseClass,
+      Float, Hash, String, TrueClass].include?(klass)
+
       raise(Puppet::ParseError, 'type(): Unknown type')
     end
 
     klass = klass.to_s # Ugly ...
 
+    #
     # We note that Integer is the parent to Bignum and Fixnum ...
+    # Plus we say Boolean for FalseClass and TrueClass ...
+    #
     result = case klass
-      when /^(?:Big|Fix)num$/ then 'Integer'
+      when /^(?:Big|Fix)num$/      then 'Integer'
+      when /^(?:False|True)Class$/ then 'Boolean'
       else klass
     end