You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2011/11/15 13:44:08 UTC

[PATCH] Remove capitalize from core-ext/string.rb ... to address JIRA DTACLOUD104

From: marios <ma...@redhat.com>

https://issues.apache.org/jira/browse/DTACLOUD-104
May be a typo but not sure what the intended behaviour was here. Ruby already provides a
capitalize ("String" from "STRING" or "sTRiNG") and also an  'upcase'
("STRING" from "StrING" or "string").

Signed-off-by: marios <ma...@redhat.com>
---
 server/lib/deltacloud/core_ext/string.rb |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/server/lib/deltacloud/core_ext/string.rb b/server/lib/deltacloud/core_ext/string.rb
index c5d9bf3..70d0df6 100644
--- a/server/lib/deltacloud/core_ext/string.rb
+++ b/server/lib/deltacloud/core_ext/string.rb
@@ -59,7 +59,4 @@ class String
     self[0, 1].downcase + self[1..-1]
   end
 
-  def capitalize
-    self[0, 1].upcase + self[1..-1]
-  end
 end
-- 
1.7.6.4


Re: [PATCH] Remove capitalize from core-ext/string.rb ... to address JIRA DTACLOUD104

Posted by David Lutterkort <lu...@redhat.com>.
On Tue, 2011-11-15 at 16:41 +0100, Michal Fojtik wrote:
> 
> marios@redhat.com wrote:
> > From: marios <ma...@redhat.com>
> > 
> > https://issues.apache.org/jira/browse/DTACLOUD-104 May be a typo but
> > not sure what the intended behaviour was here. Ruby already provides
> > a capitalize ("String" from "STRING" or "sTRiNG") and also an
> > 'upcase' ("STRING" from "StrING" or "string").
> > 
> 
> I would prefer to use cimi_capitalize in order to avoid conflict with
> Ruby instead of deleting that method. But maybe lutter can explain why
> he used this override.

Clearly, it's much better than the one provided by Ruby ;)

Seriously though, the way it is used in cimi/model/schema.rb, it's used
to map 'camelCased' to 'CamelCased'; to avoid confusion we should rename
it to something like 'upcase_first' or similar.

David



Re: [PATCH] Remove capitalize from core-ext/string.rb ... to address JIRA DTACLOUD104

Posted by Michal Fojtik <mf...@redhat.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



marios@redhat.com wrote:
> From: marios <ma...@redhat.com>
> 
> https://issues.apache.org/jira/browse/DTACLOUD-104 May be a typo but
> not sure what the intended behaviour was here. Ruby already provides
> a capitalize ("String" from "STRING" or "sTRiNG") and also an
> 'upcase' ("STRING" from "StrING" or "string").
> 

I would prefer to use cimi_capitalize in order to avoid conflict with
Ruby instead of deleting that method. But maybe lutter can explain why
he used this override.

 -- Michal


> Signed-off-by: marios <ma...@redhat.com> --- 
> server/lib/deltacloud/core_ext/string.rb |    3 --- 1 files changed,
> 0 insertions(+), 3 deletions(-)
> 
> diff --git a/server/lib/deltacloud/core_ext/string.rb
> b/server/lib/deltacloud/core_ext/string.rb index c5d9bf3..70d0df6
> 100644 --- a/server/lib/deltacloud/core_ext/string.rb +++
> b/server/lib/deltacloud/core_ext/string.rb @@ -59,7 +59,4 @@ class
> String self[0, 1].downcase + self[1..-1] end
> 
> -  def capitalize -    self[0, 1].upcase + self[1..-1] -  end end

- -- 
- --
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOwogPAAoJEEnFpmY+LvFRBQUH/14Eq/1TcJ85c8IWu2zlzbfa
Ti4IxKPymM9p9TKW873EMZTnhDNb7Jp1fIJvEcbO0bNMuhhPeSKaouXs6wKHg1zQ
nCAbNStfTSZ39frbmsWtoegNKmsrGJukYg5l96LuCkcAVjZd3svIB61GPxdP1Cxm
epOt5rGNgjVUsUTJV+sRMuC1UVHrN16AZICnp2gADDIa9Duqg0ne/sWketFyQLWF
Q3kv6EJhnSvxmOgWWKoTvNWrwDZjl83aVH/+fOA8xliEY89YHtGDIguBs7MHFa0a
lC7LCBYYWkuYAhxrEGq0yVo5LRc2TT8gNR8F+z92Z8HDnnptS4RN1MRRAp0zTm8=
=KrJF
-----END PGP SIGNATURE-----