oj 3.16.6 → 3.16.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95bab421dc901891ec12dc755e78eb02c517e34f205894c8cedeca3bc68401f6
4
- data.tar.gz: 61707536ecd3a9a558df8872a3ce7b60fc04c47dbd6d7da703bd0605cf2e73bb
3
+ metadata.gz: 71fccfc65816b5412064b2295b66c038029cbea37dcae9475002753850d47740
4
+ data.tar.gz: f559a6cbe6ebce9443564d679ade4e527da6784d35c7a71bf7a85c4e2c0b2f75
5
5
  SHA512:
6
- metadata.gz: a46a5aabda78c3da10739e31f403a8606de5129106dce4a8a26f84c66f3b7f63abc448944476e8780a00ba155a3f4fac00b83e92af7bfbaee9e177834351cf5d
7
- data.tar.gz: da32618ab105131c9a30527ad5d9a1624b5f229f1e0fc06fa258732af4f3b1eb21fd45a8d8980513eede69a61ac823ddb465b5d465630dd0f8928720f7ec8e3d
6
+ metadata.gz: 5cc33a15e43c946351d281b65f1f692a9ad8b4055c3848f8f540f9b7f1043a1f4f8844b67ff17ffe072193d4a1922a596f4b941ee3a93c2f4eb4b52fedf191ec
7
+ data.tar.gz: 1314ce1b2d92fe30dd971832a294ee2052ac1434a3f026fa534573c55488a60de3f2ff0f81bb1577c0dc8941c84c75e5a18ac8d79d2f86c9b52c56fc225a4eca
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.16.7 - 2024-11-01
4
+
5
+ - Changed string_writer_as_json to allow multiple arguments.
6
+
7
+ - Fixed Global variable registration added to mimic_json and rails code thanks to @byroot.
8
+
3
9
  ## 3.16.6 - 2024-09-09
4
10
 
5
11
  - Fixed issue with Rails 7.2 that changed the order of calls to to_json and as_json.
data/ext/oj/mimic_json.c CHANGED
@@ -837,11 +837,15 @@ void oj_mimic_json_methods(VALUE json) {
837
837
  } else {
838
838
  json_error = rb_define_class_under(json, "JSONError", rb_eStandardError);
839
839
  }
840
+
841
+ rb_global_variable(&oj_json_parser_error_class);
840
842
  if (rb_const_defined_at(json, rb_intern("ParserError"))) {
841
843
  oj_json_parser_error_class = rb_const_get(json, rb_intern("ParserError"));
842
844
  } else {
843
845
  oj_json_parser_error_class = rb_define_class_under(json, "ParserError", json_error);
844
846
  }
847
+
848
+ rb_global_variable(&oj_json_generator_error_class);
845
849
  if (rb_const_defined_at(json, rb_intern("GeneratorError"))) {
846
850
  oj_json_generator_error_class = rb_const_get(json, rb_intern("GeneratorError"));
847
851
  } else {
@@ -867,8 +871,8 @@ void oj_mimic_json_methods(VALUE json) {
867
871
  rb_require("oj/state");
868
872
  }
869
873
  // Pull in the JSON::State mimic file.
874
+ rb_global_variable(&state_class);
870
875
  state_class = rb_const_get_at(generator, rb_intern("State"));
871
- rb_gc_register_mark_object(state_class);
872
876
  }
873
877
 
874
878
  /* Document-module: JSON
data/ext/oj/rails.c CHANGED
@@ -1101,6 +1101,8 @@ static VALUE rails_set_decoder(VALUE self) {
1101
1101
  } else {
1102
1102
  json_error = rb_define_class_under(json, "JSONError", rb_eStandardError);
1103
1103
  }
1104
+
1105
+ rb_global_variable(&oj_json_parser_error_class);
1104
1106
  if (rb_const_defined_at(json, rb_intern("ParserError"))) {
1105
1107
  oj_json_parser_error_class = rb_const_get(json, rb_intern("ParserError"));
1106
1108
  } else {
@@ -475,16 +475,16 @@ static VALUE str_writer_to_s(VALUE self) {
475
475
  }
476
476
 
477
477
  /* Document-method: as_json
478
- * call-seq: as_json()
478
+ * call-seq: as_json(*)
479
479
  *
480
480
  * Returns the contents of the writer as a JSON element. If called from inside
481
481
  * an array or hash by Oj the raw buffer will be used othersize a more
482
482
  * inefficient parse of the contents and a return of the result is
483
- * completed. The parse uses the strict mode.
483
+ * completed. The parse uses the strict mode. Optional arguments are ignored.
484
484
  *
485
485
  * *return* [_Hash_|_Array_|_String_|_Integer_|_Float_|_True_|_False_|_nil|)
486
486
  */
487
- static VALUE str_writer_as_json(VALUE self) {
487
+ static VALUE str_writer_as_json(int argc, VALUE *argv, VALUE self) {
488
488
  if (string_writer_optimized) {
489
489
  return self;
490
490
  }
@@ -515,5 +515,5 @@ void oj_string_writer_init(void) {
515
515
  rb_define_method(oj_string_writer_class, "reset", str_writer_reset, 0);
516
516
  rb_define_method(oj_string_writer_class, "to_s", str_writer_to_s, 0);
517
517
  rb_define_method(oj_string_writer_class, "raw_json", str_writer_to_s, 0);
518
- rb_define_method(oj_string_writer_class, "as_json", str_writer_as_json, 0);
518
+ rb_define_method(oj_string_writer_class, "as_json", str_writer_as_json, -1);
519
519
  }
data/lib/oj/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Oj
2
2
  # Current version of the module.
3
- VERSION = '3.16.6'
3
+ VERSION = '3.16.7'
4
4
  end
data/test/test_compat.rb CHANGED
@@ -468,7 +468,7 @@ class CompatJuice < Minitest::Test
468
468
 
469
469
  def test_arg_passing
470
470
  json = Oj.to_json(Argy.new(), :max_nesting => 40)
471
- assert_equal(%|{"args":"[{:max_nesting=>40}]"}|, json)
471
+ assert_match(/.*max_nesting.*40.*/, json)
472
472
  end
473
473
 
474
474
  def test_max_nesting
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.6
4
+ version: 3.16.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-09 00:00:00.000000000 Z
11
+ date: 2024-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal