incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 3/4] Core: Improved camelize method to upcase first letter in string
Date Wed, 19 Oct 2011 13:44:09 GMT
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
View raw message