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 2012/03/16 18:35:02 UTC
[PATCH 5/9] Hack to String underscore - add exception for CIMI VSPs ("VSPs" become "vsps", not "vs_ps")
From: marios <ma...@redhat.com>
Signed-off-by: marios <ma...@redhat.com>
---
server/lib/deltacloud/core_ext/string.rb | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
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)
--
1.7.6.5