ara.t.howard / noaa.gov wrote:
> here's a start:
> 
> harp:~ > cat a.rb
> def snake_case string
>   return string unless string =~ %r/[A-Z]/
>   
> string.reverse.scan(%r/[A-Z]+|[^A-Z]*[A-Z]+?|[^A-Z]+/).reverse.map{|word| 
> word.reverse.downcase}.join '_'
> end

Can we agree that "ABCde" => "ab_cde"?

I still get an error when the original string has underscores in it:

   "foo_Bar" => "foo__bar"
   "foo_BAR" => "foo__bar"

Too tired to figure out a solution right now, I'll get back to you in 
the morning (that'll probably be your night.)


Cheers,
Daniel