[Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ?

Thibaut Barrère thibaut.barrere at gmail.com
Wed Mar 4 05:15:40 EST 2009


Hi Ivan,

> Well you can require activesupport
> Or you can look at Inflector.NET from Andrew Peters. He ported that
> inflection stuff from activesupport to .NET

The code I'm using is an extract from activesupport inflector. I
didn't want to carry the whole dependency for the moment.

thanks for the pointer (Inflector.NET), I'll have a look!

-- Thibaut

>
>
> On Wed, Mar 4, 2009 at 10:36 AM, Thibaut Barrère <thibaut.barrere at gmail.com>
> wrote:
>>
>> Hi,
>>
>> looking if I can use the internals better: is there a built-in
>> IronRuby way to convert "flow_layout_panel" to "FlowLayoutPanel" ? As
>> it's used all over the place when calling methods, I thought that
>> maybe I could use it as well.
>>
>> I'm currently using this which works well:
>>
>> module Classifier
>>  def classify(string)
>>    string.gsub(/(^|_)(.)/) { $2.upcase } # simplified version of
>> Rails inflector
>>  end
>> end
>>
>> If I can remove some code though, I'm happy. Is the code to achieve
>> this accessible ?
>>
>> -- Thibaut
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>


More information about the Ironruby-core mailing list