summaryrefslogtreecommitdiff
path: root/chop.rb
diff options
context:
space:
mode:
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-29 23:30:32 +0100
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-29 23:30:32 +0100
commit0ff8b00a64426acf96d0659d1cbc1f67bba842f4 (patch)
tree34c846c222a34df5059e618be48a3585d9a78458 /chop.rb
parent726746649e38615b69aa372ec978b2ffa39b89d5 (diff)
Small re-factor. Changed if not to unless for code clarity.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Diffstat (limited to 'chop.rb')
-rw-r--r--chop.rb3
1 files changed, 2 insertions, 1 deletions
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