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 --- chop.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'chop.rb') diff --git a/chop.rb b/chop.rb index 2f6b2d2..32ce040 100644 --- a/chop.rb +++ b/chop.rb @@ -13,12 +13,13 @@ module Puppet::Parser::Functions value = arguments[0] klass = value.class - if not [Array, String].include?(klass) + unless [Array, String].include?(klass) raise(Puppet::ParseError, 'chop(): Requires either an ' + '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.chop : i } else result = value.chop -- cgit v1.2.3