X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;ds=sidebyside;f=3rdparty%2Fmodules%2Fstdlib%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fdelete.rb;h=9dd5164de072c6e5e335b63c5f35a4a84bcd0032;hb=6963202b4b62c2816655ac9532521b018fdf83bd;hp=f548b44445795f8cf46a105ad52b308d388d5909;hpb=a69999e580f8b3abd12446c2d6ad59e517651813;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete.rb b/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete.rb index f548b4444..9dd5164de 100644 --- a/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete.rb +++ b/3rdparty/modules/stdlib/lib/puppet/parser/functions/delete.rb @@ -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