multi_json 1.12.2 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +25 -0
- data/README.md +32 -33
- data/lib/multi_json.rb +1 -1
- data/lib/multi_json/adapters/nsjsonserialization.rb +3 -0
- data/lib/multi_json/adapters/oj.rb +43 -5
- data/lib/multi_json/options_cache.rb +2 -2
- data/lib/multi_json/version.rb +2 -2
- metadata +28 -33
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ba3f1870ebd467a8356a8138d7bba83f224659a5cea2d4f9a845fa88e8d4934f
|
4
|
+
data.tar.gz: 89051067684a2f7f101dbc1b00e8cc4a417fdb9b829e476db6d90ea2cc4cf37b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f317d2719838c2466a2ca066b25259a2653cf639198a9e47fc0c0365a8a02e8307feaa4392b445ae1f918c92c4cc7deb833e1c1945c4682cd3dac3d91af9789
|
7
|
+
data.tar.gz: 81b37aeb82f9744a93eec867a54e3a83537bedb6f29747818187b6fc27d599a6ee88f239db382f85ed840319e19452f43f09c29655ac664e9a4680bc33c335a8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
1.14.2
|
2
|
+
------
|
3
|
+
|
4
|
+
* [Improve detection of json_gem adapter](https://github.com/intridea/multi_json/commit/62d54019b17ebf83b28c8deb871a02a122e7d9cf)
|
5
|
+
|
6
|
+
1.14.1
|
7
|
+
------
|
8
|
+
|
9
|
+
* [Fix a warning in Ruby 2.7](https://github.com/intridea/multi_json/commit/26a94ab8c78a394cc237e2ea292c1de4f6ed30d7)
|
10
|
+
|
11
|
+
1.14.0
|
12
|
+
------
|
13
|
+
|
14
|
+
* [Support Oj 3.x gem](https://github.com/intridea/multi_json/commit/5d8febdbebc428882811b90d514f3628617a61d5)
|
15
|
+
|
16
|
+
1.13.1
|
17
|
+
------
|
18
|
+
|
19
|
+
* [Fix missing stdlib set dependency in oj adapter](https://github.com/intridea/multi_json/commit/c4ff66e7bee6fb4f45e54429813d7fada1c152b8)
|
20
|
+
|
21
|
+
1.13.0
|
22
|
+
-----
|
23
|
+
|
24
|
+
* [Make Oj adapter handle JSON::ParseError correctly](https://github.com/intridea/multi_json/commit/275e3ffd8169797c510d23d9ef5b8b07e64c3b42)
|
25
|
+
|
1
26
|
1.12.2
|
2
27
|
------
|
3
28
|
|
data/README.md
CHANGED
@@ -2,13 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](http://img.shields.io/gem/v/multi_json.svg)][gem]
|
4
4
|
[![Build Status](http://travis-ci.org/intridea/multi_json.svg)][travis]
|
5
|
-
[![
|
6
|
-
[![Code Climate](http://img.shields.io/codeclimate/github/intridea/multi_json.svg)][codeclimate]
|
7
|
-
|
8
|
-
[gem]: https://rubygems.org/gems/multi_json
|
9
|
-
[travis]: http://travis-ci.org/intridea/multi_json
|
10
|
-
[gemnasium]: https://gemnasium.com/intridea/multi_json
|
11
|
-
[codeclimate]: https://codeclimate.com/github/intridea/multi_json
|
5
|
+
[![Code Climate](https://codeclimate.com/github/intridea/multi_json.svg)][codeclimate]
|
12
6
|
|
13
7
|
Lots of Ruby libraries parse JSON and everyone has their favorite JSON coder.
|
14
8
|
Instead of choosing a single JSON coder and forcing users of your library to be
|
@@ -51,38 +45,31 @@ load any. When loading, libraries are ordered by speed. First Oj, then Yajl,
|
|
51
45
|
then the JSON gem, then JSON pure. If no other JSON library is available,
|
52
46
|
MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
|
53
47
|
|
54
|
-
[okjson]: https://github.com/kr/okjson
|
55
|
-
|
56
48
|
## Supported JSON Engines
|
57
49
|
|
58
|
-
* [Oj]
|
59
|
-
* [Yajl]
|
60
|
-
* [JSON]
|
61
|
-
* [JSON Pure]
|
62
|
-
* [NSJSONSerialization]
|
63
|
-
* [gson.rb]
|
64
|
-
* [JrJackson]
|
50
|
+
* [Oj][oj] Optimized JSON by Peter Ohler
|
51
|
+
* [Yajl][yajl] Yet Another JSON Library by Brian Lopez
|
52
|
+
* [JSON][json-gem] The default JSON gem with C-extensions (ships with Ruby 1.9+)
|
53
|
+
* [JSON Pure][json-gem] A Ruby variant of the JSON gem
|
54
|
+
* [NSJSONSerialization][nsjson] Wrapper for Apple's NSJSONSerialization in the Cocoa Framework (MacRuby only)
|
55
|
+
* [gson.rb][gson] A Ruby wrapper for google-gson library (JRuby only)
|
56
|
+
* [JrJackson][jrjackson] JRuby wrapper for Jackson (JRuby only)
|
65
57
|
* [OkJson][okjson] A simple, vendorable JSON parser
|
66
58
|
|
67
59
|
## Supported Ruby Versions
|
68
60
|
This library aims to support and is [tested against][travis] the following Ruby
|
69
61
|
implementations:
|
70
62
|
|
71
|
-
* Ruby 1.8
|
72
|
-
* Ruby 1.9
|
73
|
-
* Ruby
|
74
|
-
* Ruby 2.0.0
|
63
|
+
* Ruby 1.8
|
64
|
+
* Ruby 1.9
|
65
|
+
* Ruby 2.0
|
75
66
|
* Ruby 2.1
|
76
|
-
* Ruby 2.2
|
77
|
-
* Ruby 2.
|
78
|
-
* Ruby 2.
|
67
|
+
* Ruby 2.2
|
68
|
+
* Ruby 2.4
|
69
|
+
* Ruby 2.5
|
70
|
+
* Ruby 2.6
|
71
|
+
* Ruby 2.7
|
79
72
|
* [JRuby][]
|
80
|
-
* [Rubinius][]
|
81
|
-
* [MacRuby][] (not tested on Travis CI)
|
82
|
-
|
83
|
-
[jruby]: http://www.jruby.org/
|
84
|
-
[rubinius]: http://rubini.us/
|
85
|
-
[macruby]: http://www.macruby.org/
|
86
73
|
|
87
74
|
If something doesn't work in one of these implementations, it's a bug.
|
88
75
|
|
@@ -112,11 +99,23 @@ Constraint][pvc] with two digits of precision. For example:
|
|
112
99
|
spec.add_dependency 'multi_json', '~> 1.0'
|
113
100
|
```
|
114
101
|
|
115
|
-
[semver]: http://semver.org/
|
116
|
-
[pvc]: http://docs.rubygems.org/read/chapter/16#page74
|
117
|
-
|
118
102
|
## Copyright
|
119
|
-
Copyright (c) 2010-
|
103
|
+
Copyright (c) 2010-2018 Michael Bleigh, Josh Kalderimis, Erik Michaels-Ober,
|
120
104
|
and Pavel Pravosud. See [LICENSE][] for details.
|
121
105
|
|
106
|
+
[codeclimate]: https://codeclimate.com/github/intridea/multi_json
|
107
|
+
[gem]: https://rubygems.org/gems/multi_json
|
108
|
+
[gson]: https://github.com/avsej/gson.rb
|
109
|
+
[jrjackson]: https://github.com/guyboertje/jrjackson
|
110
|
+
[jruby]: http://www.jruby.org/
|
111
|
+
[json-gem]: https://github.com/flori/json
|
112
|
+
[json-pure]: https://github.com/flori/json
|
122
113
|
[license]: LICENSE.md
|
114
|
+
[macruby]: http://www.macruby.org/
|
115
|
+
[nsjson]: https://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html
|
116
|
+
[oj]: https://github.com/ohler55/oj
|
117
|
+
[okjson]: https://github.com/kr/okjson
|
118
|
+
[pvc]: http://docs.rubygems.org/read/chapter/16#page74
|
119
|
+
[semver]: http://semver.org/
|
120
|
+
[travis]: http://travis-ci.org/intridea/multi_json
|
121
|
+
[yajl]: https://github.com/brianmario/yajl-ruby
|
data/lib/multi_json.rb
CHANGED
@@ -47,7 +47,7 @@ module MultiJson
|
|
47
47
|
return :oj if defined?(::Oj)
|
48
48
|
return :yajl if defined?(::Yajl)
|
49
49
|
return :jr_jackson if defined?(::JrJackson)
|
50
|
-
return :json_gem if defined?(::JSON::
|
50
|
+
return :json_gem if defined?(::JSON::Ext::Parser)
|
51
51
|
return :gson if defined?(::Gson)
|
52
52
|
|
53
53
|
REQUIREMENT_MAP.each do |adapter, library|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# This adapter is here for legacy reasons. We can't really test it, so it's hard
|
2
|
+
# to tell if it's even working properly. If you're still using it, please
|
3
|
+
# consider migrating to any other adapter out there.
|
1
4
|
framework 'Foundation'
|
2
5
|
require 'multi_json/adapters/ok_json'
|
3
6
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'set'
|
1
2
|
require 'oj'
|
2
3
|
require 'multi_json/adapter'
|
3
4
|
|
@@ -8,17 +9,54 @@ module MultiJson
|
|
8
9
|
defaults :load, :mode => :strict, :symbolize_keys => false
|
9
10
|
defaults :dump, :mode => :compat, :time_format => :ruby, :use_to_json => true
|
10
11
|
|
11
|
-
|
12
|
+
# In certain cases OJ gem may throw JSON::ParserError exception instead
|
13
|
+
# of its own class. Also, we can't expect ::JSON::ParserError and
|
14
|
+
# ::Oj::ParseError to always be defined, since it's often not the case.
|
15
|
+
# Because of this, we can't reference those classes directly and have to
|
16
|
+
# do string comparison instead. This will not catch subclasses, but it
|
17
|
+
# shouldn't be a problem since the library is not known to be using it
|
18
|
+
# (at least for now).
|
19
|
+
class ParseError < ::SyntaxError
|
20
|
+
WRAPPED_CLASSES = %w[Oj::ParseError JSON::ParserError].to_set.freeze
|
21
|
+
|
22
|
+
def self.===(exception)
|
23
|
+
case exception
|
24
|
+
when ::SyntaxError
|
25
|
+
true
|
26
|
+
else
|
27
|
+
WRAPPED_CLASSES.include?(exception.class.to_s)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
12
31
|
|
13
32
|
def load(string, options = {})
|
14
33
|
options[:symbol_keys] = options[:symbolize_keys]
|
15
34
|
::Oj.load(string, options)
|
16
35
|
end
|
17
36
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
37
|
+
case ::Oj::VERSION
|
38
|
+
when /\A2\./
|
39
|
+
def dump(object, options = {})
|
40
|
+
options.merge!(:indent => 2) if options[:pretty]
|
41
|
+
options[:indent] = options[:indent].to_i if options[:indent]
|
42
|
+
::Oj.dump(object, options)
|
43
|
+
end
|
44
|
+
when /\A3\./
|
45
|
+
PRETTY_STATE_PROTOTYPE = {
|
46
|
+
:indent => " ",
|
47
|
+
:space => " ",
|
48
|
+
:space_before => "",
|
49
|
+
:object_nl => "\n",
|
50
|
+
:array_nl => "\n",
|
51
|
+
:ascii_only => false,
|
52
|
+
}
|
53
|
+
|
54
|
+
def dump(object, options = {})
|
55
|
+
options.merge!(PRETTY_STATE_PROTOTYPE.dup) if options.delete(:pretty)
|
56
|
+
::Oj.dump(object, options)
|
57
|
+
end
|
58
|
+
else
|
59
|
+
fail "Unsupported Oj version: #{::Oj::VERSION}"
|
22
60
|
end
|
23
61
|
end
|
24
62
|
end
|
@@ -7,9 +7,9 @@ module MultiJson
|
|
7
7
|
@load_cache = {}
|
8
8
|
end
|
9
9
|
|
10
|
-
def fetch(type, key)
|
10
|
+
def fetch(type, key, &block)
|
11
11
|
cache = instance_variable_get("@#{type}_cache")
|
12
|
-
cache.key?(key) ? cache[key] : write(cache, key, &
|
12
|
+
cache.key?(key) ? cache[key] : write(cache, key, &block)
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
data/lib/multi_json/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module MultiJson
|
2
2
|
class Version
|
3
3
|
MAJOR = 1 unless defined? MultiJson::Version::MAJOR
|
4
|
-
MINOR =
|
5
|
-
PATCH =
|
4
|
+
MINOR = 15 unless defined? MultiJson::Version::MINOR
|
5
|
+
PATCH = 0 unless defined? MultiJson::Version::PATCH
|
6
6
|
PRE = nil unless defined? MultiJson::Version::PRE
|
7
7
|
|
8
8
|
class << self
|
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.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -10,45 +10,37 @@ authors:
|
|
10
10
|
- Pavel Pravosud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T6Klcr4UFvss5oW1Wtg0BdRCS5V7v8ZvnJ3mfD7rw+J3c7ylpT
|
30
|
-
9F4c4JLfJsg+FFbkDSETB1LfviGKPkpfjL3Uy1z6nWOko62XpFUiBydB9hnq0Fll
|
31
|
-
pDshFjNeJVp6BgWXjVs9m8h1hRvGsy0WxEF/IQ+V5Dw7hvi+qg5K6eMoXvpv3OJh
|
32
|
-
Io9NF6vsT7YYaUl+zobpp+tMYsAST801YnAa2RSSlsRKEMtsDFtC9oTQZhAhGqHb
|
33
|
-
lnsOhB8m73/1c9sJkVBZl4lGniy6lnB4BIr+2+hTXDK5AjQJC1uwKG1etzwBuCkz
|
34
|
-
8dtH5+dv1G5BCpbYE2uIVLsl+LY=
|
35
|
-
-----END CERTIFICATE-----
|
36
|
-
date: 2017-09-05 00:00:00.000000000 Z
|
13
|
+
cert_chain: []
|
14
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
37
15
|
dependencies:
|
38
16
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
17
|
+
name: rake
|
40
18
|
requirement: !ruby/object:Gem::Requirement
|
41
19
|
requirements:
|
42
20
|
- - "~>"
|
43
21
|
- !ruby/object:Gem::Version
|
44
|
-
version: '
|
22
|
+
version: '10.5'
|
45
23
|
type: :development
|
46
24
|
prerelease: false
|
47
25
|
version_requirements: !ruby/object:Gem::Requirement
|
48
26
|
requirements:
|
49
27
|
- - "~>"
|
50
28
|
- !ruby/object:Gem::Version
|
51
|
-
version: '
|
29
|
+
version: '10.5'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - "~>"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3.9'
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.9'
|
52
44
|
description: A common interface to multiple JSON libraries, including Oj, Yajl, the
|
53
45
|
JSON gem (with C-extensions), the pure-Ruby JSON gem, NSJSONSerialization, gson.rb,
|
54
46
|
JrJackson, and OkJson.
|
@@ -83,10 +75,15 @@ files:
|
|
83
75
|
- lib/multi_json/parse_error.rb
|
84
76
|
- lib/multi_json/vendor/okjson.rb
|
85
77
|
- lib/multi_json/version.rb
|
86
|
-
homepage:
|
78
|
+
homepage: https://github.com/intridea/multi_json
|
87
79
|
licenses:
|
88
80
|
- MIT
|
89
|
-
metadata:
|
81
|
+
metadata:
|
82
|
+
bug_tracker_uri: https://github.com/intridea/multi_json/issues
|
83
|
+
changelog_uri: https://github.com/intridea/multi_json/blob/v1.15.0/CHANGELOG.md
|
84
|
+
documentation_uri: https://www.rubydoc.info/gems/multi_json/1.15.0
|
85
|
+
source_code_uri: https://github.com/intridea/multi_json/tree/v1.15.0
|
86
|
+
wiki_uri: https://github.com/intridea/multi_json/wiki
|
90
87
|
post_install_message:
|
91
88
|
rdoc_options: []
|
92
89
|
require_paths:
|
@@ -102,10 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
99
|
- !ruby/object:Gem::Version
|
103
100
|
version: 1.3.5
|
104
101
|
requirements: []
|
105
|
-
|
106
|
-
rubygems_version: 2.6.13
|
102
|
+
rubygems_version: 3.0.3
|
107
103
|
signing_key:
|
108
104
|
specification_version: 4
|
109
105
|
summary: A common interface to multiple JSON libraries.
|
110
106
|
test_files: []
|
111
|
-
has_rdoc:
|
checksums.yaml.gz.sig
DELETED
Binary file
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
Binary file
|