deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [3/9] git commit: Hack to String underscore - add exception for CIMI VSPs ("VSPs" become "vsps", not "vs_ps")
Date Tue, 20 Mar 2012 10:10:20 GMT
Hack to String underscore - add exception for CIMI VSPs ("VSPs" become "vsps", not "vs_ps")


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/b48fa1e8
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/b48fa1e8
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/b48fa1e8

Branch: refs/heads/master
Commit: b48fa1e8808d52e43fc3b00c61acaf6ed3403f03
Parents: 5418e6d
Author: marios <marios@redhat.com>
Authored: Fri Mar 16 19:14:55 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Tue Mar 20 12:09:08 2012 +0200

----------------------------------------------------------------------
 server/lib/deltacloud/core_ext/string.rb |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b48fa1e8/server/lib/deltacloud/core_ext/string.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/core_ext/string.rb b/server/lib/deltacloud/core_ext/string.rb
index b3e2dbe..c0dce7b 100644
--- a/server/lib/deltacloud/core_ext/string.rb
+++ b/server/lib/deltacloud/core_ext/string.rb
@@ -45,11 +45,12 @@ class String
   end
 
   def underscore
-      gsub(/::/, '/').
-          gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
-          gsub(/([a-z\d])([A-Z])/,'\1_\2').
-          tr("-", "_").
-          downcase
+    return self.downcase if self =~ /VSPs$/i
+    gsub(/::/, '/').
+    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
+    gsub(/([a-z\d])([A-Z])/,'\1_\2').
+    tr("-", "_").
+    downcase
   end
 
   def camelize(lowercase_first_letter=nil)


Mime
View raw message