incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962284 - /incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb
Date Thu, 08 Jul 2010 23:43:19 GMT
Author: lutter
Date: Thu Jul  8 23:43:19 2010
New Revision: 962284

URL: http://svn.apache.org/viewvc?rev=962284&view=rev
Log:
Validation: allow adding more parameters from a hash

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb?rev=962284&r1=962283&r2=962284&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/validation.rb Thu Jul  8 23:43:19 2010
@@ -43,6 +43,15 @@ module Deltacloud::Validation
     @params
   end
 
+  # Add the parameters in hash +new+ to already existing parameters. If
+  # +new+ contains a parameter with an already existing name, the old
+  # definition is clobbered.
+  def add_params(new)
+    # We do not check for duplication on purpose: multiple calls
+    # to add_params should be cumulative
+    new.each { |p|  @params[p.name] = p }
+  end
+
   def each_param(&block)
     params.each_value { |p| yield p }
   end



Mime
View raw message