Todd Benson
9/30/2008 4:14:00 AM
On Mon, Sep 29, 2008 at 10:22 PM, Allen Walker <auswalk@gmail.com> wrote:
> If I have a String like "DistributionMethod" is there any helper out
> there that will turn it into "distribution_method" ?
I'm sure there's one out there, but for simple cases...
s = "SomeCamelCase"
s.scan(/.*?[A-Z].*?[^A-Z]*?/).map {|w| w.downcase}.join("_")
Todd