Thibaut Barrère
2009-Mar-04 09:36 UTC
[Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ?
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
Ivan Porto Carrero
2009-Mar-04 10:01 UTC
[Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ?
Well you can require activesupport Or you can look at Inflector.NET from Andrew Peters. He ported that inflection stuff from activesupport to .NET 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090304/c8ac7647/attachment.html>
Thibaut Barrère
2009-Mar-04 10:15 UTC
[Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ?
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 .NETThe 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 > >
Ivan Porto Carrero
2009-Mar-04 10:56 UTC
[Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ?
I''ve added the inflector stuff to IronRuby MVC too. The only thing I added to the library was to make it all extension methods. In IronNails I also pulled in the files from active support because I didn''t want to take the dependency atm. On Wed, Mar 4, 2009 at 11:15 AM, Thibaut Barr?re <thibaut.barrere at gmail.com>wrote:> 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 > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090304/050cc410/attachment.html>
Jimmy Schementi
2009-Mar-05 16:54 UTC
[Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ?
IronRuby has RubyUtils.MangleName/TryUnmangleName in /Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Wednesday, March 04, 2009 2:57 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ? I''ve added the inflector stuff to IronRuby MVC too. The only thing I added to the library was to make it all extension methods. In IronNails I also pulled in the files from active support because I didn''t want to take the dependency atm. On Wed, Mar 4, 2009 at 11:15 AM, Thibaut Barr?re <thibaut.barrere at gmail.com<mailto:thibaut.barrere at gmail.com>> wrote: 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 .NETThe 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<mailto: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<mailto:Ironruby-core at rubyforge.org> >> http://rubyforge.org/mailman/listinfo/ironruby-core > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> > http://rubyforge.org/mailman/listinfo/ironruby-core > >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090305/fe14ff6f/attachment.html>
Thibaut Barrère
2009-Mar-07 19:59 UTC
[Ironruby-core] Is there a built-in way to convert from snake_case to CamelCase ?
Hi Jimmy,> IronRuby has RubyUtils.MangleName/TryUnmangleName in > /Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs.thanks for the hint. -- Thibaut> > > > From: ironruby-core-bounces at rubyforge.org > [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero > Sent: Wednesday, March 04, 2009 2:57 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Is there a built-in way to convert from > snake_case to CamelCase ? > > > > I''ve added the inflector stuff to IronRuby MVC too. The only thing I added > to the library was to make it all extension methods. > > In IronNails I also pulled in the files from active support because I didn''t > want to take the dependency atm. > > On Wed, Mar 4, 2009 at 11:15 AM, Thibaut Barr?re <thibaut.barrere at gmail.com> > wrote: > > 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 >> >> > _______________________________________________ > 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 > >