str = "isn't stands for is not"
puts str.sub(/'/) { "\\\'" } #=> isn\'t stands for is not

After execution, irb prints an #inspect on the resulting object.

-austin
--
austin ziegler    * austin / halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.11.26
                                         * 13.48.12