You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/03/20 11:10:20 UTC

[3/9] git commit: Hack to String underscore - add exception for CIMI VSPs ("VSPs" become "vsps", not "vs_ps")

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 <ma...@redhat.com>
Authored: Fri Mar 16 19:14:55 2012 +0200
Committer: marios <ma...@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)