Reverting name back to bool2num.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
Krzysztof Wilczynski 2011-04-29 20:10:53 +01:00
parent 07847be9b9
commit 4c097b0a09

View file

@ -3,18 +3,18 @@
# #
module Puppet::Parser::Functions module Puppet::Parser::Functions
newfunction(:bool2number, :type => :rvalue, :doc => <<-EOS newfunction(:bool2num, :type => :rvalue, :doc => <<-EOS
EOS EOS
) do |arguments| ) do |arguments|
raise(Puppet::ParseError, "bool2number(): Wrong number of arguments " + raise(Puppet::ParseError, "bool2num(): Wrong number of arguments " +
"given (#{arguments.size} for 1)") if arguments.size < 1 "given (#{arguments.size} for 1)") if arguments.size < 1
value = arguments[0] value = arguments[0]
klass = value.class klass = value.class
if not [FalseClass, String, TrueClass].include?(klass) if not [FalseClass, String, TrueClass].include?(klass)
raise(Puppet::ParseError, 'bool2number(): Requires either an ' + raise(Puppet::ParseError, 'bool2num(): Requires either an ' +
'boolean or string to work with') 'boolean or string to work with')
end end
@ -30,7 +30,7 @@ module Puppet::Parser::Functions
# This is not likely to happen ... # This is not likely to happen ...
when /^(undef|undefined)$/ then 0 when /^(undef|undefined)$/ then 0
else else
raise(Puppet::ParseError, 'bool2number(): Unknown type of boolean given') raise(Puppet::ParseError, 'bool2num(): Unknown type of boolean given')
end end
else else
# We have real boolean values as well ... # We have real boolean values as well ...