diff options
Diffstat (limited to 'capitalize.rb')
-rw-r--r-- | capitalize.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/capitalize.rb b/capitalize.rb index 74d4f28..ac6cc50 100644 --- a/capitalize.rb +++ b/capitalize.rb @@ -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 |