From: marios <mar...@redhat.com> Used as part of CIMI schema class, but causes naming conflict with Ruby's own 'capitalize': https://issues.apache.org/jira/browse/DTACLOUD-104
Signed-off-by: marios <mar...@redhat.com> --- server/lib/cimi/model/schema.rb | 4 ++-- server/lib/deltacloud/core_ext/string.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/lib/cimi/model/schema.rb b/server/lib/cimi/model/schema.rb index e470121..8b0911b 100644 --- a/server/lib/cimi/model/schema.rb +++ b/server/lib/cimi/model/schema.rb @@ -136,11 +136,11 @@ class CIMI::Model::Schema private def struct - cname = "CIMI_#{json_name.capitalize}" + cname = "CIMI_#{json_name.upcase_first}" if ::Struct.const_defined?(cname) ::Struct.const_get(cname) else - ::Struct.new("CIMI_#{json_name.capitalize}", + ::Struct.new("CIMI_#{json_name.upcase_first}", *@schema.attribute_names) end end diff --git a/server/lib/deltacloud/core_ext/string.rb b/server/lib/deltacloud/core_ext/string.rb index c5d9bf3..53b3984 100644 --- a/server/lib/deltacloud/core_ext/string.rb +++ b/server/lib/deltacloud/core_ext/string.rb @@ -59,7 +59,7 @@ class String self[0, 1].downcase + self[1..-1] end - def capitalize + def upcase_first self[0, 1].upcase + self[1..-1] end end -- 1.7.6.4