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:
parent
6d9e5efe38
commit
726746649e
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue