Unrubify 2
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 unrubify 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.
def unrubify(sentence)
sentence.capitalize!
sentence.gsub!(/_(.)/) { $1.upcase }
return sentence
end
Any suggestions on improvements please let me know!
Thank you!!! I thought it should be there somewhere, but couldn’t find it.