Un–Rubify

Often times while writing meta programming code, I am using the eval function and doing manipulation on method/class/variable names.

Today I needed to un–Rubify a name. I haven’t seen this done regularly, and unfortunately there is no fun Rails method to do it (there is one for Rubifying a string).

So, here is my attempt at it, for anyone trying to solve the same problem:

1 def unrubify(sentence)  
2   sentence.capitalize!
3   sentence.gsub!(/_(.)/) { $1.upcase }
4   return sentence 
5 end

If you have any suggestions, please let me know!

Paul Pagel, Chief Executive Officer

Paul Pagel has been a driving force in the software craftsmanship movement since its inception.