* ext/objspace/objspace_dump.c (dump_append_string_value): Escape

control characters for strict json parsers.
* ext/objspace/objspace_dump.c (objspace_dump): Document File/IO
  output option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tmm1 2013-11-26 05:27:22 +00:00
Родитель 0791c940ad
Коммит adcd0174b9
2 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Tue Nov 26 14:23:17 2013 Aman Gupta <ruby@tmm1.net>
* ext/objspace/objspace_dump.c (dump_append_string_value): Escape
control characters for strict json parsers.
* ext/objspace/objspace_dump.c (objspace_dump): Document File/IO
output option.
Tue Nov 26 11:43:19 2013 Masaki Matsushita <glass.saga@gmail.com>
* ruby_atomic.h: use __atomic builtin functions supported by GCC.

Просмотреть файл

@ -82,7 +82,10 @@ dump_append_string_value(struct dump_config *dc, VALUE obj)
dump_append(dc, "\\r");
break;
default:
dump_append(dc, "%c", c);
if (c <= 0x1f)
dump_append(dc, "\\u%04d", c);
else
dump_append(dc, "%c", c);
}
}
dump_append(dc, "\"");
@ -362,6 +365,8 @@ objspace_dump(int argc, VALUE *argv, VALUE os)
* ObjectSpace.dump_all([output: :file]) # => #<File:/tmp/rubyheap20131125-88469-laoj3v.json>
* ObjectSpace.dump_all(output: :stdout) # => nil
* ObjectSpace.dump_all(output: :string) # => "{...}\n{...}\n..."
* ObjectSpace.dump_all(output:
* File.open('heap.json','w')) # => #<File:heap.json>
*
* Dump the contents of the ruby heap as JSON.
*