]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Moved to unless from if not for code clarity and changed wording
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Fri, 29 Apr 2011 23:57:24 +0000 (00:57 +0100)
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Fri, 29 Apr 2011 23:57:24 +0000 (00:57 +0100)
of few error messages.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
delete_at.rb

index 1869476e019bcd4780a4f29729f015757741326a..10190ba07f2474324d5984068b52866281a42ab4 100644 (file)
@@ -12,25 +12,25 @@ module Puppet::Parser::Functions
 
     array = arguments[0]
 
-    if not array.is_a?(Array)
-      raise(Puppet::ParseError, 'delete_at(): Requires an array to work with')
+    unless array.is_a?(Array)
+      raise(Puppet::ParseError, 'delete_at(): Requires array to work with')
     end
 
     index = arguments[1]
 
     if index.is_a?(String) and not index.match(/^\d+$/)
       raise(Puppet::ParseError, 'delete_at(): You must provide ' +
-        'positive numeric index')
+        'non-negative numeric index')
     end
 
     result = array.clone
 
-    # In Puppet numbers are often string-encoded ...
+    # Numbers in Puppet are often string-encoded which is troublesome ...
     index = index.to_i
 
     if index > result.size - 1 # First element is at index 0 is it not?
       raise(Puppet::ParseError, 'delete_at(): Given index ' +
-        'exceeds array size')
+        'exceeds size of array given')
     end
 
     result.delete_at(index) # We ignore the element that got deleted ...