You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Mohammed Morsi <mm...@redhat.com> on 2010/08/04 22:03:23 UTC

[PATCH] support array request param types with ability to specify type of array elements

---
 server/lib/deltacloud/validation.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/validation.rb b/server/lib/deltacloud/validation.rb
index b4eb3ae..33b0c45 100644
--- a/server/lib/deltacloud/validation.rb
+++ b/server/lib/deltacloud/validation.rb
@@ -13,11 +13,12 @@ module Deltacloud::Validation
   end
 
   class Param
-    attr_reader :name, :klass, :type, :options, :description
+    attr_reader :name, :klass, :array_klass, :type, :options, :description
 
     def initialize(args)
       @name = args[0]
       @klass = args[1] || :string
+      @array_klass = args.delete_at(2) if @klass == :array
       @type = args[2] || :optional
       @options = args[3] || []
       @description = args[4] || ''
-- 
1.7.2


Re: [PATCH] support array request param types with ability to specify type of array elements

Posted by Michal Fojtik <mf...@redhat.com>.
On 04/08/10 16:03 -0400, Mohammed Morsi wrote:
>---
> server/lib/deltacloud/validation.rb |    3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
>diff --git a/server/lib/deltacloud/validation.rb b/server/lib/deltacloud/validation.rb
>index b4eb3ae..33b0c45 100644
>--- a/server/lib/deltacloud/validation.rb
>+++ b/server/lib/deltacloud/validation.rb
>@@ -13,11 +13,12 @@ module Deltacloud::Validation
>   end
>
>   class Param
>-    attr_reader :name, :klass, :type, :options, :description
>+    attr_reader :name, :klass, :array_klass, :type, :options, :description
>
>     def initialize(args)
>       @name = args[0]
>       @klass = args[1] || :string
>+      @array_klass = args.delete_at(2) if @klass == :array
>       @type = args[2] || :optional
>       @options = args[3] || []
>       @description = args[4] || ''
>--
>1.7.2

ACK.

Seems good, applied cleanly.

  -- Michal

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com, +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
--------------------------------------------------------