You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by fv...@redhat.com on 2011/02/02 15:53:04 UTC

[PATCH core] Modified the way custom Exception are created on rabbit.rb, using Class.new

From: Francesco Vollero <fv...@redhat.com>


Modified the way custom Exception are created on rabbit.rb using the Class.new way since its a clean way to have this kind of class defined.

---
 server/lib/sinatra/rabbit.rb |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb
index a2b1c3d..b6e480b 100644
--- a/server/lib/sinatra/rabbit.rb
+++ b/server/lib/sinatra/rabbit.rb
@@ -7,10 +7,10 @@ module Sinatra
 
   module Rabbit
 
-    class DuplicateParamException < Exception; end
-    class DuplicateOperationException < Exception; end
-    class DuplicateCollectionException < Exception; end
-    class UnsupportedCollectionException < Exception; end
+    DuplicateParamException        = Class.new(Exception)
+    DuplicateOperationException    = Class.new(Exception)
+    DuplicateCollectionException   = Class.new(Exception)
+    UnsupportedCollectionException = Class.new(Exception)
 
     class Operation
       attr_reader :name, :method, :collection
-- 
1.7.3.5


Re: [PATCH core] Modified the way custom Exception are created on rabbit.rb, using Class.new

Posted by Francesco Vollero <fv...@redhat.com>.
Ok but just take a look here [1].

-Francesco

[1] http://blog.rubybestpractices.com/posts/gregory/anonymous_class_hacks.html

----- Original Message -----
From: "David Lutterkort" <lu...@redhat.com>
To: deltacloud-dev@incubator.apache.org
Sent: Thursday, February 3, 2011 1:56:09 AM
Subject: Re: [PATCH core] Modified the way custom Exception are created on rabbit.rb, using Class.new

On Wed, 2011-02-02 at 15:53 +0100, fvollero@redhat.com wrote:
> Modified the way custom Exception are created on rabbit.rb using the
> Class.new way since its a clean way to have this kind of class
> defined.

NAK. The way it is right now is perfectly understandable Ruby (I'd argue
more understandable than Class.new to create a subclass)

David



Re: [PATCH core] Modified the way custom Exception are created on rabbit.rb, using Class.new

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2011-02-02 at 15:53 +0100, fvollero@redhat.com wrote:
> Modified the way custom Exception are created on rabbit.rb using the
> Class.new way since its a clean way to have this kind of class
> defined.

NAK. The way it is right now is perfectly understandable Ruby (I'd argue
more understandable than Class.new to create a subclass)

David