From 0ff8b00a64426acf96d0659d1cbc1f67bba842f4 Mon Sep 17 00:00:00 2001 From: Krzysztof Wilczynski Date: Fri, 29 Apr 2011 23:30:32 +0100 Subject: Small re-factor. Changed if not to unless for code clarity. Signed-off-by: Krzysztof Wilczynski --- chomp.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'chomp.rb') diff --git a/chomp.rb b/chomp.rb index bec3adf..aba9e8d 100644 --- a/chomp.rb +++ b/chomp.rb @@ -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 -- cgit v1.2.3