1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Improve documentation for String#{dump,undump}

This commit is contained in:
Marcus Stollsteimer 2019-05-05 09:51:40 +02:00
parent bb4ac7a650
commit 35ff4ed47f

View file

@ -6007,14 +6007,16 @@ rb_str_inspect(VALUE str)
* call-seq: * call-seq:
* str.dump -> new_str * str.dump -> new_str
* *
* Produces a quoted version of +str+ with all non-printing characters replaced * Returns a quoted version of the string with all non-printing characters
* by <code>\xHH</code> notation and all special characters escaped. * replaced by <code>\xHH</code> notation and all special characters escaped.
* *
* This method can be used for round-trip: if the resulting +new_str+ is * This method can be used for round-trip: if the resulting +new_str+ is
* eval'ed, it will produce the original string. * eval'ed, it will produce the original string.
* *
* "hello \n ''".dump #=> "\"hello \\n ''\"" * "hello \n ''".dump #=> "\"hello \\n ''\""
* "\f\x00\xff\\\"".dump #=> "\"\\f\\x00\\xFF\\\\\\\"\"" * "\f\x00\xff\\\"".dump #=> "\"\\f\\x00\\xFF\\\\\\\"\""
*
* See also String#undump.
*/ */
VALUE VALUE
@ -6303,8 +6305,8 @@ static VALUE rb_str_is_ascii_only_p(VALUE str);
* call-seq: * call-seq:
* str.undump -> new_str * str.undump -> new_str
* *
* Produces unescaped version of +str+. * Returns an unescaped version of the string.
* See also String#dump because String#undump does inverse of String#dump. * This does the inverse of String#dump.
* *
* "\"hello \\n ''\"".undump #=> "hello \n ''" * "\"hello \\n ''\"".undump #=> "hello \n ''"
*/ */