[erlang-questions] Rails Style String Inflection For Erlang

Luke Galea galeal@REDACTED
Tue Sep 9 03:32:16 CEST 2008


Hi erlangers,

Thanks to the help I received on this list, I've managed to complete  
inflector.erl. You can get it at http://www.ideaforge.org/blog/?p=11

It handles everything relevant that ruby's ActiveSupport inflector  
can do: pluralize, singularize, camelcase, etc.

There was a lot of discussion re: pattern matching versus regular  
expressions. Ultimately I chose to release this first version with  
the R12B4 regexps, but cached them to minimize the overhead from  
compiling.

I think there might be some value in separating out the regexp cache,  
unless there is a simpler way to avoid recompiling regexps that I  
missed.

Thanks again for everyone's help.

-- Luke Galea



More information about the erlang-questions mailing list