*
*/
@JRubyMethod(name = {"quote", "escape"}, required = 1, optional = 1, meta = true, compat = CompatVersion.RUBY1_8)
public static RubyString quote(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Ruby runtime = context.getRuntime();
final KCode code;
if (args.length == 1 || args[1].isNil()) {
code = runtime.getKCode();
} else {
code = KCode.create(runtime, args[1].toString());
}
RubyString src = args[0].convertToString();
RubyString dst = RubyString.newStringShared(runtime, quote(src.getByteList(), code.getEncoding()));
dst.infectBy(src);
return dst;
}