You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2010/08/25 16:42:26 UTC

[PATCH core 2/6] Tuned pluralization for Rabbit

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

diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb
index f411268..91d48da 100644
--- a/server/lib/sinatra/rabbit.rb
+++ b/server/lib/sinatra/rabbit.rb
@@ -256,10 +256,12 @@ class String
   end
 
   def pluralize
+    return self+'es' if self =~ /ss$/
     self + "s"
   end
 
   def singularize
+    return self.gsub(/es$/, '') if self =~ /ses$/
     self.gsub(/s$/, '')
   end
 
-- 
1.7.2


Re: [PATCH core 2/6] Tuned pluralization for Rabbit

Posted by Michal Fojtik <mf...@redhat.com>.
On 26/08/10 16:11 -0700, David Lutterkort wrote:
>On Wed, 2010-08-25 at 16:42 +0200, mfojtik@redhat.com wrote:
>> ---
>>  server/lib/sinatra/rabbit.rb |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>
>ACK. Need to remember to fix this up as soon as we add a cabooses
>collection.

Yeah, I really want to avoid copying Rails pluralization into our project
or requiring some of Rails code... Hopefully we will be ok with this for
some time ;-)

  -- Michal

>David
>
>

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

Re: [PATCH core 2/6] Tuned pluralization for Rabbit

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2010-08-25 at 16:42 +0200, mfojtik@redhat.com wrote:
> ---
>  server/lib/sinatra/rabbit.rb |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

ACK. Need to remember to fix this up as soon as we add a cabooses
collection.

David