deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik ...@mifo.sk>
Subject Re: [PATCH] Rename 'capitalize' in core-ext/string.rb to 'upcase_first'
Date Wed, 16 Nov 2011 09:18:22 GMT
ACK.

--- michal

Sent from my tablet.

On 16.11.2011, at 9:58, marios@redhat.com wrote:

> From: marios <marios@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 <marios@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
> 

Mime
View raw message