multi_json 1.16.0 → 1.18.0

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: 7cfed43da6fae7ff4d1ca11dc248a43fe89d00f184f2e955599467a7b45b6cbe
4
- data.tar.gz: d6d16e3c6fd7c3334bf7b44b84896f6ac675dd503ccf4ffc6d2bc2ef415098c4
3
+ metadata.gz: e4844623fce51f6461e352b05ed0bf04712f213e33a290398c5ee46847a2fefb
4
+ data.tar.gz: 78985a7bae5a3c1001f19151f85ed221c8e392811edfda5ab3eb916785d6c465
5
5
  SHA512:
6
- metadata.gz: 2712e385429e988fddeca64fbe93347eb3a2f6d5d4c3fa83f9ffb40e292e09f35fdf1ee0b82be7d6caa8ccd1d09995f41cb7803546b12e8f3082190bd5556625
7
- data.tar.gz: bb3cd2dd7a39f1a6d7aa8b52d2786d908e2e15bc5ed94d750ef458666ef903bcccf2383883841d11795f972bf5923170d84410a1459aa14792448c6d0b583ff8
6
+ metadata.gz: 728727f42292c6aeb50fe442f60bd930a68aa7de9713ce109806e204b071a9ef4763b766a6860fa1407724584413ae3d298fe75cfc081aed69e4654e687dce0c
7
+ data.tar.gz: 54df198586a1118df89ce5467cc9ada2942842c10ed88355e5891f2b39b79a219516647a8beea2f7facfc24d78def27659e984840a5eb28388a5a1d4a689c29f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ 1.18.0
2
+ ------
3
+ * [Fix conflict between JSON gem and ActiveSupport](https://github.com/intridea/multi_json/issues/222)
4
+
5
+ 1.17.0
6
+ ------
7
+ * [Revert minimum ruby version requirement](https://github.com/sferik/multi_json/pull/16)
8
+
1
9
  1.16.0
2
10
  ------
3
11
  * [Remove `NSJSONSerialization`](https://github.com/sferik/multi_json/commit/0423d3b5886e93405f4c2221687b7e3329bd2940)
@@ -157,12 +165,12 @@
157
165
 
158
166
  1.6.0
159
167
  -----
160
- * [Add gson.rb support](https://github.com/sferik/multi_json/pull/71)
161
- * [Add MultiJson.default_options](https://github.com/sferik/multi_json/pull/70)
162
- * [Add MultiJson.with_adapter](https://github.com/sferik/multi_json/pull/67)
163
- * [Stringify all possible keys for ok_json](https://github.com/sferik/multi_json/pull/66)
168
+ * [Add gson.rb support](https://github.com/intridea/multi_json/pull/71)
169
+ * [Add MultiJson.default_options](https://github.com/intridea/multi_json/pull/70)
170
+ * [Add MultiJson.with_adapter](https://github.com/intridea/multi_json/pull/67)
171
+ * [Stringify all possible keys for ok_json](https://github.com/intridea/multi_json/pull/66)
164
172
  * [Use JSON.generate instead of #to_json](https://github.com/sferik/multi_json/issues/73)
165
- * [Alias `MultiJson::DecodeError` to `MultiJson::LoadError`](https://github.com/sferik/multi_json/pull/79)
173
+ * [Alias `MultiJson::DecodeError` to `MultiJson::LoadError`](https://github.com/intridea/multi_json/pull/79)
166
174
 
167
175
  1.5.1
168
176
  -----
data/README.md CHANGED
@@ -59,10 +59,13 @@ MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
59
59
  This library aims to support and is [tested against](https://github.com/sferik/multi_json/actions/workflows/ci.yml) the following Ruby
60
60
  implementations:
61
61
 
62
+ - Ruby 3.0
63
+ - Ruby 3.1
62
64
  - Ruby 3.2
63
65
  - Ruby 3.3
64
66
  - Ruby 3.4
65
- - [JRuby 10][jruby]
67
+ - [JRuby][jruby] 9.4 (targets Ruby 3.1 compatibility)
68
+ - [JRuby][jruby] 10.0 (targets Ruby 3.4 compatibility)
66
69
 
67
70
  If something doesn't work in one of these implementations, it's a bug.
68
71
 
@@ -25,9 +25,14 @@ module MultiJson
25
25
  end
26
26
 
27
27
  def dump(object, options = {})
28
- options.merge!(PRETTY_STATE_PROTOTYPE) if options.delete(:pretty)
28
+ opts = options.dup
29
29
 
30
- object.to_json(options)
30
+ if opts.delete(:pretty)
31
+ opts = PRETTY_STATE_PROTOTYPE.merge(opts)
32
+ return ::JSON.pretty_generate(object, opts)
33
+ end
34
+
35
+ ::JSON.generate(object, opts)
31
36
  end
32
37
  end
33
38
  end
@@ -16,7 +16,7 @@ module MultiJson
16
16
  # shouldn't be a problem since the library is not known to be using it
17
17
  # (at least for now).
18
18
  class ParseError < ::SyntaxError
19
- WRAPPED_CLASSES = %w[Oj::ParseError JSON::ParserError].to_set.freeze
19
+ WRAPPED_CLASSES = %w[Oj::ParseError JSON::ParserError].freeze
20
20
  private_constant :WRAPPED_CLASSES
21
21
 
22
22
  def self.===(exception)
@@ -6,6 +6,7 @@ module MultiJson
6
6
  module Adapters
7
7
  class OkJson < Adapter
8
8
  include ConvertibleHashKeys
9
+
9
10
  ParseError = ::MultiJson::OkJson::Error
10
11
 
11
12
  def load(string, options = {})
@@ -17,12 +17,12 @@ module MultiJson
17
17
  end
18
18
  end
19
19
 
20
- def prepare_hash(value, &)
20
+ def prepare_hash(value, &block)
21
21
  case value
22
22
  when Array
23
- handle_array(value, &)
23
+ handle_array(value, &block)
24
24
  when Hash
25
- handle_hash(value, &)
25
+ handle_hash(value, &block)
26
26
  else
27
27
  handle_simple_objects(value)
28
28
  end
@@ -10,12 +10,12 @@ module MultiJson
10
10
  @dump_options = options
11
11
  end
12
12
 
13
- def load_options(*)
14
- (defined?(@load_options) && get_options(@load_options, *)) || default_load_options
13
+ def load_options(*args)
14
+ (defined?(@load_options) && get_options(@load_options, *args)) || default_load_options
15
15
  end
16
16
 
17
- def dump_options(*)
18
- (defined?(@dump_options) && get_options(@dump_options, *)) || default_dump_options
17
+ def dump_options(*args)
18
+ (defined?(@dump_options) && get_options(@dump_options, *args)) || default_dump_options
19
19
  end
20
20
 
21
21
  def default_load_options
@@ -28,8 +28,8 @@ module MultiJson
28
28
 
29
29
  private
30
30
 
31
- def get_options(options, *)
32
- return handle_callable_options(options, *) if options_callable?(options)
31
+ def get_options(options, *args)
32
+ return handle_callable_options(options, *args) if options_callable?(options)
33
33
 
34
34
  handle_hashable_options(options)
35
35
  end
@@ -38,8 +38,8 @@ module MultiJson
38
38
  options.respond_to?(:call)
39
39
  end
40
40
 
41
- def handle_callable_options(options, *)
42
- options.arity.zero? ? options.call : options.call(*)
41
+ def handle_callable_options(options, *args)
42
+ options.arity.zero? ? options.call : options.call(*args)
43
43
  end
44
44
 
45
45
  def handle_hashable_options(options)
@@ -20,7 +20,7 @@ module MultiJson
20
20
  end
21
21
  end
22
22
 
23
- def fetch(key, &)
23
+ def fetch(key)
24
24
  @mutex.synchronize do
25
25
  return @cache[key] if @cache.key?(key)
26
26
  end
@@ -1,7 +1,7 @@
1
1
  module MultiJson
2
2
  class Version
3
3
  MAJOR = 1 unless defined? MultiJson::Version::MAJOR
4
- MINOR = 16 unless defined? MultiJson::Version::MINOR
4
+ MINOR = 18 unless defined? MultiJson::Version::MINOR
5
5
  PATCH = 0 unless defined? MultiJson::Version::PATCH
6
6
  PRE = nil unless defined? MultiJson::Version::PRE
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -45,10 +45,10 @@ licenses:
45
45
  - MIT
46
46
  metadata:
47
47
  bug_tracker_uri: https://github.com/sferik/multi_json/issues
48
- changelog_uri: https://github.com/sferik/multi_json/blob/v1.16.0/CHANGELOG.md
49
- documentation_uri: https://www.rubydoc.info/gems/multi_json/1.16.0
48
+ changelog_uri: https://github.com/sferik/multi_json/blob/v1.18.0/CHANGELOG.md
49
+ documentation_uri: https://www.rubydoc.info/gems/multi_json/1.18.0
50
50
  rubygems_mfa_required: 'true'
51
- source_code_uri: https://github.com/sferik/multi_json/tree/v1.16.0
51
+ source_code_uri: https://github.com/sferik/multi_json/tree/v1.18.0
52
52
  wiki_uri: https://github.com/sferik/multi_json/wiki
53
53
  rdoc_options: []
54
54
  require_paths:
@@ -57,14 +57,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '3.2'
60
+ version: '3.0'
61
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  requirements: []
67
- rubygems_version: 3.6.9
67
+ rubygems_version: 3.7.2
68
68
  specification_version: 4
69
69
  summary: A common interface to multiple JSON libraries.
70
70
  test_files: []