diff options
Diffstat (limited to 'chomp.rb')
-rw-r--r-- | chomp.rb | 5 |
1 files changed, 3 insertions, 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, 'chomp(): Requires either an ' + + unless [Array, String].include?(klass) + raise(Puppet::ParseError, 'chomp(): 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.chomp : i } else result = value.chomp |