Update stdlib
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / delete.rb
index f548b44..9dd5164 100644 (file)
@@ -2,8 +2,6 @@
 # delete.rb
 #
 
-# TODO(Krzysztof Wilczynski): We need to add support for regular expression ...
-
 module Puppet::Parser::Functions
   newfunction(:delete, :type => :rvalue, :doc => <<-EOS
 Deletes all instances of a given element from an array, substring from a
@@ -25,10 +23,7 @@ string, or key from a hash.
   EOS
   ) do |arguments|
 
-    if (arguments.size != 2) then
-      raise(Puppet::ParseError, "delete(): Wrong number of arguments "+
-                                  "given #{arguments.size} for 2.")
-    end
+    raise(Puppet::ParseError, "delete(): Wrong number of arguments given #{arguments.size} for 2") unless arguments.size == 2
 
     collection = arguments[0].dup
     Array(arguments[1]).each do |item|
@@ -38,8 +33,7 @@ string, or key from a hash.
         when String
           collection.gsub! item, ''
         else
-          raise(TypeError, "delete(): First argument must be an Array, " +
-                             "String, or Hash. Given an argument of class #{collection.class}.")
+          raise(TypeError, "delete(): First argument must be an Array, String, or Hash. Given an argument of class #{collection.class}.")
       end
     end
     collection