[flori/json] Use rb_sym2str instead of SYM2ID

This avoids pinning an id to the symbol used if a dynamic symbol is
passed in as a hash key.

rb_sym2str is available in Ruby 2.2+ and json depends on >= 2.3.

https://github.com/flori/json/commit/5cbafb8dbe
This commit is contained in:
John Hawthorn 2023-12-05 13:44:28 -08:00 committed by Hiroshi SHIBATA
parent 65ec74a8dd
commit ea5776e7e4

View File

@ -867,7 +867,7 @@ json_object_i(VALUE key, VALUE val, VALUE _arg)
if (klass == rb_cString) {
key_to_s = key;
} else if (klass == rb_cSymbol) {
key_to_s = rb_id2str(SYM2ID(key));
key_to_s = rb_sym2str(key);
} else {
key_to_s = rb_funcall(key, i_to_s, 0);
}