Small re-factor. Changed if not to unless for code clarity.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
Krzysztof Wilczynski 2011-04-29 23:18:58 +01:00
parent 6d9e5efe38
commit 726746649e

View file

@ -13,12 +13,13 @@ module Puppet::Parser::Functions
value = arguments[0]
klass = value.class
if not [Array, String].include?(klass)
raise(Puppet::ParseError, 'capitalize(): Requires either an ' +
unless [Array, String].include?(klass)
raise(Puppet::ParseError, 'capitalize(): Requires either ' +
'array or string to work with')
end
if value.is_a?(Array)
# Numbers in Puppet are often string-encoded ...
result = value.collect { |i| i.is_a?(String) ? i.capitalize : i }
else
result = value.capitalize