# # strquote.rb # # Copyright (c) 1999 Minero Aoki <aamine@dp.u-netsurf.ne.jp> # class String def quoted ret = '' str = self while str.size > 0 do /\n|\r\n|\r|\z/o === str part = $` term = $& str = $' while part and part.size > 0 do tmp = part[ 0, 50 ].inspect ret << tmp[ 1, tmp.size - 2 ] part = part[ 50, str.size - 50 ] end tmp = term.inspect ret << tmp[ 1, tmp.size - 2 ] end return ret end end