summaryrefslogtreecommitdiff
path: root/type.rb
diff options
context:
space:
mode:
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-29 20:05:44 +0100
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-29 20:05:44 +0100
commit5e9721983a6239338dea13b8efaef9f679bebb33 (patch)
tree0c739084618d179290485ece965d063d227b5e6c /type.rb
parent085874afc35659909653eaf22a16ff37ebe72a73 (diff)
Added FalseClass and TrueClass to be identified as Boolean to the type function.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Diffstat (limited to 'type.rb')
-rw-r--r--type.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/type.rb b/type.rb
index 389a056..ac1895c 100644
--- 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