I know if I subclass the String class and override its capitalize method, I can call the String class’ version of capitalize with super. What if instead I reopened the String class and rewrote the capitalize method? Is there a way I can call the previous version of that method?
I know if I subclass the String class and override its capitalize method, I
Share
Not out of the box. A common approach is to rename the existing method to a new name. Then, in your rewritten version, call the old method by the new name.
You might also want to look at
alias_method_chain, which does some of this for you.