incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tong Li <liton...@us.ibm.com>
Subject Re: [PATCH core 3/4] Core: Improved camelize method to upcase first letter in string
Date Thu, 20 Oct 2011 01:31:47 GMT

The changes actually break things. for a string like  "machine_images",
what is needed is actually "machineImages", not MachineImages, so the
method does not do what it needs to. The original method does. I think that
this patch needs to be reverted. The strings are actually needed in the
cloudEntryPoint response. In other places, there is a need for
MachineImage, but never the string MachineImages.

Thanks.

Tong Li
Emerging Technologies & Standards
B062/K317
litong01@us.ibm.com



From:	mfojtik@redhat.com
To:	deltacloud-dev@incubator.apache.org
Date:	10/19/2011 09:55 AM
Subject:	[PATCH core 3/4] Core: Improved camelize method to upcase first
            letter in string



From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/core_ext/string.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/core_ext/string.rb
b/server/lib/deltacloud/core_ext/string.rb
index 1cd79a0..42d5677 100644
--- a/server/lib/deltacloud/core_ext/string.rb
+++ b/server/lib/deltacloud/core_ext/string.rb
@@ -52,6 +52,6 @@ class String


   def camelize
-    gsub(/_[a-z]/) { |match| match[1].chr.upcase }
+    split('_').map { |w| w.capitalize }.join
   end
 end
--
1.7.4.4


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message