json 3.0.0 → 3.0.1

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: b4a457db7bd0eba155736808c796e81741e7ea72438768e183a7b7a795e8de4e
4
- data.tar.gz: 61bb013e78224c5c91f620d3097986735411befd5139f33eaecb2c3c510ababe
3
+ metadata.gz: 4963523aa43ad467929b9530b04f5c27a37dbbb1891186251d1495f3fac1f5ee
4
+ data.tar.gz: caf3f18bf24b587b0832f911b692f1e1149c1bfc5d14b5c5e1b255f6f95689f9
5
5
  SHA512:
6
- metadata.gz: 6e0b4b4a8160235dcef28c7924ecda754a7ae792a714e6b5fbc5baa810fd358129c4340dd1056d31df823bf139f2b42bccb9c2d400c7282079d3dcf3b2f8c2c8
7
- data.tar.gz: e67782447e1934dcada56b848982e6bb15708997b9eca220f7b631470734e0b14b2b227ac82612b03b8eb6b3d54b7686d4627a6d551d05b8252da40203f07087
6
+ metadata.gz: 78c8ac1a917008d3724b2a2e708d96c929de3924e4d7e1d85eb87e02a0e0a0c827bbe320464b8bb2ab8f6816ba0e5d48a8d57d3d5f00b15093aad8b9f12ce66b
7
+ data.tar.gz: '03867f4f7fef6bd2c14e5bfc1e426b710ad662807306c3475b63a6464e20ed10cb59646b1d6ff2b8b9b88ecb74150d7619133d8e0993c1b9666c7a7e6dd9315b'
data/CHANGES.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ### Unreleased
4
4
 
5
+ ### 2026-09-08 (3.0.1)
6
+
7
+ * Restore the `limit` positional argument of `JSON.dump`.
8
+
5
9
  ### 2026-09-07 (3.0.0)
6
10
 
7
11
  * Add `JSON::ParserError#json_path` to locate parse errors in the document as a JSONPath-style string (e.g. `$.foo[0].bar`). For duplicate key errors it points at the duplicated key itself.
data/lib/json/common.rb CHANGED
@@ -726,16 +726,14 @@ module JSON
726
726
  end
727
727
 
728
728
  # :call-seq:
729
- # JSON.dump(obj, io = nil, options = nil)
729
+ # JSON.dump(obj, io = nil, _deprecated_limit = nil, options = nil)
730
730
  #
731
731
  # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result.
732
732
  #
733
- # The default options can be changed via method JSON.dump_default_options.
734
- #
735
733
  # - Argument +io+, if given, should respond to method +write+;
736
734
  # the \JSON \String is written to +io+, and +io+ is returned.
737
735
  # If +io+ is not given, the \JSON \String is returned.
738
- #
736
+ # - Argument +_deprecated_limit+ is deprecated, pass the +:max_nesting+ option instead.
739
737
  # ---
740
738
  #
741
739
  # When argument +io+ is not given, returns the \JSON \String generated from +obj+:
@@ -751,21 +749,31 @@ module JSON
751
749
  # puts File.read(path)
752
750
  # Output:
753
751
  # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"}
754
- def dump(obj, anIO = nil, kwargs = nil)
752
+ def dump(obj, anIO = nil, _deprecated_limit = nil, kwargs = nil)
755
753
  if kwargs.nil?
756
- if anIO.is_a?(Hash)
757
- kwargs = anIO
758
- anIO = nil
754
+ if _deprecated_limit.nil?
755
+ if anIO.is_a?(Hash)
756
+ kwargs = anIO
757
+ anIO = nil
758
+ end
759
+ elsif _deprecated_limit.is_a?(Hash)
760
+ kwargs = _deprecated_limit
761
+ _deprecated_limit = nil
759
762
  end
760
763
  end
761
764
 
762
- if anIO&.respond_to?(:to_io)
763
- anIO = anIO.to_io
765
+ unless anIO.nil?
766
+ if anIO.respond_to?(:to_io)
767
+ anIO = anIO.to_io
768
+ elsif _deprecated_limit.nil? && !anIO.respond_to?(:write)
769
+ anIO, _deprecated_limit = nil, anIO
770
+ end
764
771
  end
765
772
 
766
773
  opts = {
767
774
  allow_nan: true,
768
775
  }
776
+ opts[:max_nesting] = _deprecated_limit if _deprecated_limit
769
777
  opts.merge!(kwargs) if kwargs
770
778
 
771
779
  State.generate(obj, opts, anIO)
data/lib/json/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSON
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank