multi_json 1.18.0 → 1.19.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: e4844623fce51f6461e352b05ed0bf04712f213e33a290398c5ee46847a2fefb
4
- data.tar.gz: 78985a7bae5a3c1001f19151f85ed221c8e392811edfda5ab3eb916785d6c465
3
+ metadata.gz: 611f4f415a53003438f0292ebebbed77089b802b381dd7f6ed4f80d72f731b34
4
+ data.tar.gz: dfe11c2bd0e7a4c951df6483d2f3ff48dad1ba4d7a82b71f63aaa0a1e006f65d
5
5
  SHA512:
6
- metadata.gz: 728727f42292c6aeb50fe442f60bd930a68aa7de9713ce109806e204b071a9ef4763b766a6860fa1407724584413ae3d298fe75cfc081aed69e4654e687dce0c
7
- data.tar.gz: 54df198586a1118df89ce5467cc9ada2942842c10ed88355e5891f2b39b79a219516647a8beea2f7facfc24d78def27659e984840a5eb28388a5a1d4a689c29f
6
+ metadata.gz: ded58963a98bd626c26c7500f76ec05c5bbf13205db4ae268985d027f3b90d27b2dc502a6645d9c86d3ae8e15b36fdc7e2bc1ed96a044a9a5385b9a46e176a5e
7
+ data.tar.gz: 3d896ec5964870f72e41b00cd1d6b8ea30a667f8b1bb227214930976203f54ee95a5072e01a05571846ea68c12882cc1cdf610feb9196f582a27792e9eea069b
data/CHANGELOG.md CHANGED
@@ -1,280 +1,225 @@
1
- 1.18.0
2
- ------
1
+ # Changelog
2
+
3
+ ## 1.19.0
4
+ * [Fix serialization of ActiveSupport-enhanced objects](https://github.com/sferik/multi_json/commit/03a367813ebd7ed87eb22ea05249cc6453bb3c10)
5
+
6
+ ## 1.18.0
3
7
  * [Fix conflict between JSON gem and ActiveSupport](https://github.com/intridea/multi_json/issues/222)
4
8
 
5
- 1.17.0
6
- ------
9
+ ## 1.17.0
7
10
  * [Revert minimum ruby version requirement](https://github.com/sferik/multi_json/pull/16)
8
11
 
9
- 1.16.0
10
- ------
11
- * [Remove `NSJSONSerialization`](https://github.com/sferik/multi_json/commit/0423d3b5886e93405f4c2221687b7e3329bd2940)
12
- * [Stop referencing `JSON::PRETTY_STATE_PROTOTYPE`](https://github.com/sferik/multi_json/commit/58094d7a0583bf1f5052886806a032c00f16ffc5)
12
+ ## 1.16.0
13
+ * [Remove NSJSONSerialization](https://github.com/sferik/multi_json/commit/0423d3b5886e93405f4c2221687b7e3329bd2940)
14
+ * [Stop referencing JSON::PRETTY\_STATE\_PROTOTYPE](https://github.com/sferik/multi_json/commit/58094d7a0583bf1f5052886806a032c00f16ffc5)
13
15
  * [Drop support for Ruby versions < 3.2](https://github.com/sferik/multi_json/commit/ff3b42c4bc26cd6512914b7e5321976e948985dc)
14
16
  * [Move repo from @intridea to @sferik](https://github.com/sferik/multi_json/commit/e87aeadbc9b9aa6df79818fa01bfc5fa959d8474)
15
- * [`JsonCommon`: force encoding to UTF-8, not binary](https://github.com/sferik/multi_json/commit/34dd0247de07f2703c7d42a42d4cefc73635f3cc)
16
- * [Stop setting defaults in `JsonCommon`](https://github.com/sferik/multi_json/commit/d5f9e6e72b99a7def695f430f72c8365998de625)
17
- * [Make `json_pure` an alias of `json_gem`](https://github.com/sferik/multi_json/commit/9ff7c3dcbe3650e712b38e636ad19061a4c08d1a)
17
+ * [JsonCommon: force encoding to UTF-8, not binary](https://github.com/sferik/multi_json/commit/34dd0247de07f2703c7d42a42d4cefc73635f3cc)
18
+ * [Stop setting defaults in JsonCommon](https://github.com/sferik/multi_json/commit/d5f9e6e72b99a7def695f430f72c8365998de625)
19
+ * [Make json\_pure an alias of json\_gem](https://github.com/sferik/multi_json/commit/9ff7c3dcbe3650e712b38e636ad19061a4c08d1a)
18
20
 
19
- 1.15.0
20
- ------
21
+ ## 1.15.0
21
22
  * [Improve detection of json_gem adapter](https://github.com/sferik/multi_json/commit/62d54019b17ebf83b28c8deb871a02a122e7d9cf)
22
23
 
23
- 1.14.1
24
- ------
24
+ ## 1.14.1
25
25
  * [Fix a warning in Ruby 2.7](https://github.com/sferik/multi_json/commit/26a94ab8c78a394cc237e2ea292c1de4f6ed30d7)
26
26
 
27
- 1.14.0
28
- ------
27
+ ## 1.14.0
29
28
  * [Support Oj 3.x gem](https://github.com/sferik/multi_json/commit/5d8febdbebc428882811b90d514f3628617a61d5)
30
29
 
31
- 1.13.1
32
- ------
30
+ ## 1.13.1
33
31
  * [Fix missing stdlib set dependency in oj adapter](https://github.com/sferik/multi_json/commit/c4ff66e7bee6fb4f45e54429813d7fada1c152b8)
34
32
 
35
- 1.13.0
36
- -----
33
+ ## 1.13.0
37
34
  * [Make Oj adapter handle JSON::ParseError correctly](https://github.com/sferik/multi_json/commit/275e3ffd8169797c510d23d9ef5b8b07e64c3b42)
38
35
 
39
- 1.12.2
40
- ------
36
+ ## 1.12.2
41
37
  * [Renew gem certificate](https://github.com/sferik/multi_json/commit/57922d898c6eb587cc9a28ba5724c11e81724700)
42
38
 
43
- 1.12.1
44
- ------
39
+ ## 1.12.1
45
40
  * [Prevent memory leak in OptionsCache](https://github.com/sferik/multi_json/commit/aa7498199ad272f3d4a13750d7c568a66047e2ee)
46
41
 
47
- 1.12.0
48
- ------
42
+ ## 1.12.0
49
43
  * [Introduce global options cache to improve peroformance](https://github.com/sferik/multi_json/commit/7aaef2a1bc2b83c95e4208b12dad5d1d87ff20a6)
50
44
 
51
- 1.11.2
52
- ------
45
+ ## 1.11.2
53
46
  * [Only pass one argument to JrJackson when two is not supported](https://github.com/sferik/multi_json/commit/e798fa517c817fc706982d3f3c61129b6651d601)
54
47
 
55
- 1.11.1
56
- ------
48
+ ## 1.11.1
57
49
  * [Dump method passes options throught for JrJackson adapter](https://github.com/sferik/multi_json/commit/3c730fd12135c3e7bf212f878958004908f13909)
58
50
 
59
- 1.11.0
60
- ------
51
+ ## 1.11.0
61
52
  * [Make all adapters read IO object before load](https://github.com/sferik/multi_json/commit/167f559e18d4efee05e1f160a2661d16dbb215d4)
62
53
 
63
- 1.10.1
64
- ------
54
+ ## 1.10.1
65
55
  * [Explicitly require stringio for Gson adapter](https://github.com/sferik/multi_json/commit/623ec8142d4a212fa0db763bb71295789a119929)
66
56
  * [Do not read StringIO object before passing it to JrJackson](https://github.com/sferik/multi_json/commit/a6dc935df08e7b3d5d701fbb9298384c96df0fde)
67
57
 
68
- 1.10.0
69
- ------
58
+ ## 1.10.0
70
59
  * [Performance tweaks](https://github.com/sferik/multi_json/commit/58724acfed31866d079eaafb1cd824e341ade287)
71
60
 
72
- 1.9.3
73
- -----
61
+ ## 1.9.3
74
62
  * [Convert indent option to Fixnum before passing to Oj](https://github.com/sferik/multi_json/commit/826fc5535b863b74fc9f981dfdda3e26f1ee4e5b)
75
63
 
76
- 1.9.2
77
- -----
64
+ ## 1.9.2
78
65
  * [Enable use_to_json option for Oj adapter by default](https://github.com/sferik/multi_json/commit/76a4aaf697b10bbabd5d535d83cf1149efcfe5c7)
79
66
 
80
- 1.9.1
81
- -----
67
+ ## 1.9.1
82
68
  * [Remove unused LoadError file](https://github.com/sferik/multi_json/commit/65dedd84d59baeefc25c477fedf0bbe85e7ce2cd)
83
69
 
84
- 1.9.0
85
- ----
70
+ ## 1.9.0
86
71
  * [Rename LoadError to ParseError](https://github.com/sferik/multi_json/commit/4abb98fe3a90b2a7b3d1594515c8a06042b4a27d)
87
72
  * [Adapter load failure throws AdapterError instead of ArgumentError](https://github.com/sferik/multi_json/commit/4da612b617bd932bb6fa1cc4c43210327f98f271)
88
73
 
89
- 1.8.4
90
- -----
74
+ ## 1.8.4
91
75
  * [Make Gson adapter explicitly read StringIO object](https://github.com/sferik/multi_json/commit/b58b498747ff6e94f41488c971b2a30a98760ef2)
92
76
 
93
- 1.8.3
94
- -----
77
+ ## 1.8.3
95
78
  * [Make JrJackson explicitly read StringIO objects](https://github.com/sferik/multi_json/commit/e1f162d5b668e5e4db5afa175361a601a8aa2b05)
96
79
  * [Prevent calling #downcase on alias symbols](https://github.com/sferik/multi_json/commit/c1cf075453ce0110f7decc4f906444b1233bb67c)
97
80
 
98
- 1.8.2
99
- -----
81
+ ## 1.8.2
100
82
  * [Downcase adapter string name for OS compatibility](https://github.com/sferik/multi_json/commit/b8e15a032247a63f1410d21a18add05035f3fa66)
101
83
 
102
- 1.8.1
103
- -----
84
+ ## 1.8.1
104
85
  * [Let the adapter handle strings with invalid encoding](https://github.com/sferik/multi_json/commit/6af2bf87b89f44eabf2ae9ca96779febc65ea94b)
105
86
 
106
- 1.8.0
107
- -----
87
+ ## 1.8.0
108
88
  * [Raise MultiJson::LoadError on blank input](https://github.com/sferik/multi_json/commit/c44f9c928bb25fe672246ad394b3e5b991be32e6)
109
89
 
110
- 1.7.9
111
- -----
90
+ ## 1.7.9
112
91
  * [Explicitly require json gem code even when constant is defined](https://github.com/sferik/multi_json/commit/36f7906c66477eb4b55b7afeaa3684b6db69eff2)
113
92
 
114
- 1.7.8
115
- -----
93
+ ## 1.7.8
116
94
  * [Reorder JrJackson before json_gem](https://github.com/sferik/multi_json/commit/315b6e460b6e4dcdb6c82e04e4be8ee975d395da)
117
95
  * [Update vendored OkJson to version 43](https://github.com/sferik/multi_json/commit/99a6b662f6ef4036e3ee94d7eb547fa72fb2ab50)
118
96
 
119
- 1.7.7
120
- -----
97
+ ## 1.7.7
121
98
  * [Fix options caching issues](https://github.com/sferik/multi_json/commit/a3f14c3661688c5927638fa6088c7b46a67e875e)
122
99
 
123
- 1.7.6
124
- -----
100
+ ## 1.7.6
125
101
  * [Bring back MultiJson::VERSION constant](https://github.com/sferik/multi_json/commit/31b990c2725e6673bf8ce57540fe66b57a751a72)
126
102
 
127
- 1.7.5
128
- -----
103
+ ## 1.7.5
129
104
  * [Fix warning '*' interpreted as argument prefix](https://github.com/sferik/multi_json/commit/b698962c7f64430222a1f06430669706a47aff89)
130
105
  * [Remove stdlib warning](https://github.com/sferik/multi_json/commit/d06eec6b7996ac8b4ff0e2229efd835379b0c30f)
131
106
 
132
- 1.7.4
133
- -----
107
+ ## 1.7.4
134
108
  * [Cache options for better performance](https://github.com/sferik/multi_json/commit/8a26ee93140c4bed36194ed9fb887a1b6919257b)
135
109
 
136
- 1.7.3
137
- -----
110
+ ## 1.7.3
138
111
  * [Require json/ext to ensure extension version gets loaded for json_gem](https://github.com/sferik/multi_json/commit/942686f7e8597418c6f90ee69e1d45242fac07b1)
139
112
  * [Rename JrJackson](https://github.com/sferik/multi_json/commit/078de7ba8b6035343c3e96b4767549e9ec43369a)
140
113
  * [Prefer JrJackson to JSON gem if present](https://github.com/sferik/multi_json/commit/af8bd9799a66855f04b3aff1c488485950cec7bf)
141
114
  * [Print a warning if outdated gem versions are used](https://github.com/sferik/multi_json/commit/e7438e7ba2be0236cfa24c2bb9ad40ee821286d1)
142
115
  * [Loosen required_rubygems_version for compatibility with Ubuntu 10.04](https://github.com/sferik/multi_json/commit/59fad014e8fe41dbc6f09485ea0dc21fc42fd7a7)
143
116
 
144
- 1.7.2
145
- -----
117
+ ## 1.7.2
146
118
  * [Rename Jrjackson adapter to JrJackson](https://github.com/sferik/multi_json/commit/b36dc915fc0e6548cbad06b5db6f520e040c9c8b)
147
119
  * [Implement jrjackson -> jr_jackson alias for back-compatability](https://github.com/sferik/multi_json/commit/aa50ab8b7bb646b8b75d5d65dfeadae8248a4f10)
148
120
  * [Update vendored OkJson module](https://github.com/sferik/multi_json/commit/30a3f474e17dd86a697c3fab04f468d1a4fd69d7)
149
121
 
150
- 1.7.1
151
- -----
122
+ ## 1.7.1
152
123
  * [Fix capitalization of JrJackson class](https://github.com/sferik/multi_json/commit/5373a5e38c647f02427a0477cb8e0e0dafad1b8d)
153
124
 
154
- 1.7.0
155
- -----
125
+ ## 1.7.0
156
126
  * [Add load_options/dump_options to MultiJson](https://github.com/sferik/multi_json/commit/a153956be6b0df06ea1705ce3c1ff0b5b0e27ea5)
157
127
  * [MultiJson does not modify arguments](https://github.com/sferik/multi_json/commit/58525b01c4c2f6635ba2ac13d6fd987b79f3962f)
158
128
  * [Enable quirks_mode by default for json_gem/json_pure adapters](https://github.com/sferik/multi_json/commit/1fd4e6635c436515b7d7d5a0bee4548de8571520)
159
129
  * [Add JrJackson adapter](https://github.com/sferik/multi_json/commit/4dd86fa96300aaaf6d762578b9b31ea82adb056d)
160
130
  * [Raise ArgumentError on bad adapter input](https://github.com/sferik/multi_json/commit/911a3756bdff2cb5ac06497da3fa3e72199cb7ad)
161
131
 
162
- 1.6.1
163
- -----
132
+ ## 1.6.1
164
133
  * [Revert "Use JSON.generate instead of #to_json"](https://github.com/sferik/multi_json/issues/86)
165
134
 
166
- 1.6.0
167
- -----
135
+ ## 1.6.0
168
136
  * [Add gson.rb support](https://github.com/intridea/multi_json/pull/71)
169
137
  * [Add MultiJson.default_options](https://github.com/intridea/multi_json/pull/70)
170
138
  * [Add MultiJson.with_adapter](https://github.com/intridea/multi_json/pull/67)
171
139
  * [Stringify all possible keys for ok_json](https://github.com/intridea/multi_json/pull/66)
172
140
  * [Use JSON.generate instead of #to_json](https://github.com/sferik/multi_json/issues/73)
173
- * [Alias `MultiJson::DecodeError` to `MultiJson::LoadError`](https://github.com/intridea/multi_json/pull/79)
141
+ * [Alias MultiJson::DecodeError to MultiJson::LoadError](https://github.com/intridea/multi_json/pull/79)
174
142
 
175
- 1.5.1
176
- -----
143
+ ## 1.5.1
177
144
  * [Do not allow Oj or JSON to create symbols by searching for classes](https://github.com/sferik/multi_json/commit/193e28cf4dc61b6e7b7b7d80f06f74c76df65c41)
178
145
 
179
- 1.5.0
180
- -----
181
- * [Add `MultiJson.with_adapter` method](https://github.com/sferik/multi_json/commit/d14c5d28cae96557a0421298621b9499e1f28104)
182
- * [Stringify all possible keys for `ok_json`](https://github.com/sferik/multi_json/commit/73998074058e1e58c557ffa7b9541d486d6041fa)
146
+ ## 1.5.0
147
+ * [Add MultiJson.with\_adapter method](https://github.com/sferik/multi_json/commit/d14c5d28cae96557a0421298621b9499e1f28104)
148
+ * [Stringify all possible keys for ok\_json](https://github.com/sferik/multi_json/commit/73998074058e1e58c557ffa7b9541d486d6041fa)
183
149
 
184
- 1.4.0
185
- -----
186
- * [Allow `load`/`dump` of JSON fragments](https://github.com/sferik/multi_json/commit/707aae7d48d39c85b38febbd2c210ba87f6e4a36)
150
+ ## 1.4.0
151
+ * [Allow load/dump of JSON fragments](https://github.com/sferik/multi_json/commit/707aae7d48d39c85b38febbd2c210ba87f6e4a36)
187
152
 
188
- 1.3.7
189
- -----
153
+ ## 1.3.7
190
154
  * [Fix rescue clause for MagLev](https://github.com/sferik/multi_json/commit/39abdf50199828c50e85b2ce8f8ba31fcbbc9332)
191
155
  * [Remove unnecessary check for string version of options key](https://github.com/sferik/multi_json/commit/660101b70e962b3c007d0b90d45944fa47d13ec4)
192
- * [Explicitly set default adapter when adapter is set to `nil` or `false`](https://github.com/sferik/multi_json/commit/a9e587d5a63eafb4baee9fb211265e4dd96a26bc)
193
- * [Fix Oj `ParseError` mapping for Oj 1.4.0](https://github.com/sferik/multi_json/commit/7d9045338cc9029401c16f3c409d54ce97f275e2)
156
+ * [Explicitly set default adapter when adapter is set to nil or false](https://github.com/sferik/multi_json/commit/a9e587d5a63eafb4baee9fb211265e4dd96a26bc)
157
+ * [Fix Oj ParseError mapping for Oj 1.4.0](https://github.com/sferik/multi_json/commit/7d9045338cc9029401c16f3c409d54ce97f275e2)
194
158
 
195
- 1.3.6
196
- -----
159
+ ## 1.3.6
197
160
  * [Allow adapter-specific options to be passed through to Oj](https://github.com/sferik/multi_json/commit/d0e5feeebcba0bc69400dd203a295f5c30971223)
198
161
 
199
- 1.3.5
200
- -----
162
+ ## 1.3.5
201
163
  * [Add pretty support to Oj adapter](https://github.com/sferik/multi_json/commit/0c8f75f03020c53bcf4c6be258faf433d24b2c2b)
202
164
 
203
- 1.3.4
204
- -----
205
- * [Use `class << self` instead of `module_function` to create aliases](https://github.com/sferik/multi_json/commit/ba1451c4c48baa297e049889be241a424cb05980)
165
+ ## 1.3.4
166
+ * [Use class \<\< self instead of module\_function to create aliases](https://github.com/sferik/multi_json/commit/ba1451c4c48baa297e049889be241a424cb05980)
206
167
 
207
- 1.3.3
208
- -----
168
+ ## 1.3.3
209
169
  * [Remove deprecation warnings](https://github.com/sferik/multi_json/commit/36b524e71544eb0186826a891bcc03b2820a008f)
210
170
 
211
- 1.3.2
212
- -----
171
+ ## 1.3.2
213
172
  * [Add ability to use adapter per call](https://github.com/sferik/multi_json/commit/106bbec469d5d0a832bfa31fffcb8c0f0cdc9bd3)
214
- * [Add and deprecate `default_engine` method](https://github.com/sferik/multi_json/commit/fc3df0c7a3e2ab9ce0c2c7e7617a4da97dd13f6e)
173
+ * [Add and deprecate default\_engine method](https://github.com/sferik/multi_json/commit/fc3df0c7a3e2ab9ce0c2c7e7617a4da97dd13f6e)
215
174
 
216
- 1.3.1
217
- -----
175
+ ## 1.3.1
218
176
  * [Only warn once for each instance a deprecated method is called](https://github.com/sferik/multi_json/commit/e21d6eb7da74b3f283995c1d27d5880e75f0ae84)
219
177
 
220
- 1.3.0
221
- -----
222
- * [Implement `load`/`dump`; deprecate `decode`/`encode`](https://github.com/sferik/multi_json/commit/e90fd6cb1b0293eb0c73c2f4eb0f7a1764370216)
178
+ ## 1.3.0
179
+ * [Implement load/dump; deprecate decode/encode](https://github.com/sferik/multi_json/commit/e90fd6cb1b0293eb0c73c2f4eb0f7a1764370216)
223
180
  * [Rename engines to adapters](https://github.com/sferik/multi_json/commit/ae7fd144a7949a9c221dcaa446196ec23db908df)
224
181
 
225
- 1.2.0
226
- -----
182
+ ## 1.2.0
227
183
  * [Add support for Oj](https://github.com/sferik/multi_json/commit/acd06b233edabe6c44f226873db7b49dab560c60)
228
184
 
229
- 1.1.0
230
- -----
231
- * [`NSJSONSerialization` support for MacRuby](https://github.com/sferik/multi_json/commit/f862e2fc966cac8867fe7da3997fc76e8a6cf5d4)
185
+ ## 1.1.0
186
+ * [NSJSONSerialization support for MacRuby](https://github.com/sferik/multi_json/commit/f862e2fc966cac8867fe7da3997fc76e8a6cf5d4)
232
187
 
233
- 1.0.4
234
- -----
235
- * [Set data context to `DecodeError` exception](https://github.com/sferik/multi_json/commit/19ddafd44029c6681f66fae2a0f6eabfd0f85176)
236
- * [Allow `ok_json` to fallback to `to_json`](https://github.com/sferik/multi_json/commit/c157240b1193b283d06d1bd4d4b5b06bcf3761f8)
237
- * [Add warning when using `ok_json`](https://github.com/sferik/multi_json/commit/dd4b68810c84f826fb98f9713bfb29ab96888d57)
188
+ ## 1.0.4
189
+ * [Set data context to DecodeError exception](https://github.com/sferik/multi_json/commit/19ddafd44029c6681f66fae2a0f6eabfd0f85176)
190
+ * [Allow ok\_json to fallback to to\_json](https://github.com/sferik/multi_json/commit/c157240b1193b283d06d1bd4d4b5b06bcf3761f8)
191
+ * [Add warning when using ok\_json](https://github.com/sferik/multi_json/commit/dd4b68810c84f826fb98f9713bfb29ab96888d57)
238
192
  * [Options can be passed to an engine on encode](https://github.com/sferik/multi_json/commit/e0a7ff5d5ff621ffccc61617ed8aeec5816e81f7)
239
193
 
240
- 1.0.3
241
- -----
242
- * [`Array` support for `stringify_keys`](https://github.com/sferik/multi_json/commit/644d1c5c7c7f6a27663b11668527b346094e38b9)
243
- * [`Array` support for `symbolize_keys`](https://github.com/sferik/multi_json/commit/c885377d47a2aa39cb0d971fea78db2d2fa479a7)
244
-
245
- 1.0.2
246
- -----
247
- * [Allow encoding of rootless JSON when `ok_json` is used](https://github.com/sferik/multi_json/commit/d1cde7de97cb0f6152aef8daf14037521cdce8c6)
248
-
249
- 1.0.1
250
- -----
251
- * [Correct an issue with `ok_json` not being returned as the default engine](https://github.com/sferik/multi_json/commit/d33c141619c54cccd770199694da8fd1bd8f449d)
252
-
253
- 1.0.0
254
- -----
255
- * [Remove `ActiveSupport::JSON` support](https://github.com/sferik/multi_json/commit/c2f4140141d785a24b3f56e58811b0e561b37f6a)
256
- * [Fix `@engine` ivar warning](https://github.com/sferik/multi_json/commit/3b978a8995721a8dffedc3b75a7f49e5494ec553)
257
- * [Only `rescue` from parsing errors during decoding, not any `StandardError`](https://github.com/sferik/multi_json/commit/391d00b5e85294d42d41347605d8d46b4a7f66cc)
258
- * [Rename `okjson` engine and vendored lib to `ok_json`](https://github.com/sferik/multi_json/commit/5bd1afc977a8208ddb0443e1d57cb79665c019f1)
259
- * [Add `StringIO` support to `json` gem and `ok_json`](https://github.com/sferik/multi_json/commit/1706b11568db7f50af451fce5f4d679aeb3bbe8f)
260
-
261
- 0.0.5
262
- -----
263
- * [Trap all JSON decoding errors; raise `MultiJson::DecodeError`](https://github.com/sferik/multi_json/commit/dea9a1aef6dd1212aa1e5a37ab1669f9b045b732)
264
-
265
- 0.0.4
266
- -----
267
- * [Fix default_engine check for `json` gem](https://github.com/sferik/multi_json/commit/caced0c4e8c795922a109ebc00c3c4fa8635bed8)
268
- * [Make requirement mapper an `Array` to preserve order in Ruby versions < 1.9](https://github.com/sferik/multi_json/commit/526f5f29a42131574a088ad9bbb43d7f48439b2c)
269
-
270
- 0.0.3
271
- -----
194
+ ## 1.0.3
195
+ * [Array support for stringify\_keys](https://github.com/sferik/multi_json/commit/644d1c5c7c7f6a27663b11668527b346094e38b9)
196
+ * [Array support for symbolize\_keys](https://github.com/sferik/multi_json/commit/c885377d47a2aa39cb0d971fea78db2d2fa479a7)
197
+
198
+ ## 1.0.2
199
+ * [Allow encoding of rootless JSON when ok\_json is used](https://github.com/sferik/multi_json/commit/d1cde7de97cb0f6152aef8daf14037521cdce8c6)
200
+
201
+ ## 1.0.1
202
+ * [Correct an issue with ok\_json not being returned as the default engine](https://github.com/sferik/multi_json/commit/d33c141619c54cccd770199694da8fd1bd8f449d)
203
+
204
+ ## 1.0.0
205
+ * [Remove ActiveSupport::JSON support](https://github.com/sferik/multi_json/commit/c2f4140141d785a24b3f56e58811b0e561b37f6a)
206
+ * [Fix @engine ivar warning](https://github.com/sferik/multi_json/commit/3b978a8995721a8dffedc3b75a7f49e5494ec553)
207
+ * [Only rescue from parsing errors during decoding, not any StandardError](https://github.com/sferik/multi_json/commit/391d00b5e85294d42d41347605d8d46b4a7f66cc)
208
+ * [Rename okjson engine and vendored lib to ok\_json](https://github.com/sferik/multi_json/commit/5bd1afc977a8208ddb0443e1d57cb79665c019f1)
209
+ * [Add StringIO support to json gem and ok\_json](https://github.com/sferik/multi_json/commit/1706b11568db7f50af451fce5f4d679aeb3bbe8f)
210
+
211
+ ## 0.0.5
212
+ * [Trap all JSON decoding errors; raise MultiJson::DecodeError](https://github.com/sferik/multi_json/commit/dea9a1aef6dd1212aa1e5a37ab1669f9b045b732)
213
+
214
+ ## 0.0.4
215
+ * [Fix default\_engine check for json gem](https://github.com/sferik/multi_json/commit/caced0c4e8c795922a109ebc00c3c4fa8635bed8)
216
+ * [Make requirement mapper an Array to preserve order in Ruby versions \< 1.9](https://github.com/sferik/multi_json/commit/526f5f29a42131574a088ad9bbb43d7f48439b2c)
217
+
218
+ ## 0.0.3
272
219
  * [Improve defaulting and documentation](https://github.com/sferik/twitter/commit/3a0e41b9e4b0909201045fa47704b78c9d949b73)
273
220
 
274
- 0.0.2
275
- -----
276
- * [Rename to `multi_json`](https://github.com/sferik/twitter/commit/461ab89ce071c8c9fabfc183581e0ec523788b62)
221
+ ## 0.0.2
222
+ * [Rename to multi\_json](https://github.com/sferik/twitter/commit/461ab89ce071c8c9fabfc183581e0ec523788b62)
277
223
 
278
- 0.0.1
279
- -----
224
+ ## 0.0.1
280
225
  * [Initial commit](https://github.com/sferik/twitter/commit/518c21ab299c500527491e6c049ab2229e22a805)
data/CONTRIBUTING.md CHANGED
@@ -10,7 +10,7 @@ Here are some ways *you* can contribute:
10
10
  * by reporting bugs
11
11
  * by suggesting new features
12
12
  * by writing or editing documentation
13
- * by writing specifications
13
+ * by writing tests
14
14
  * by writing code (**no patch is too small**: fix typos, add comments, clean up
15
15
  inconsistent whitespace)
16
16
  * by refactoring code
@@ -22,24 +22,30 @@ Here are some ways *you* can contribute:
22
22
  ## Submitting an Issue
23
23
  We use the [GitHub issue tracker][issues] to track bugs and features. Before
24
24
  submitting a bug report or feature request, check to make sure it hasn't
25
- already been submitted. When submitting a bug report, please include a [Gist][]
26
- that includes a stack trace and any details that may be necessary to reproduce
27
- the bug, including your gem version, Ruby version, and operating system.
28
- Ideally, a bug report should include a pull request with failing specs.
25
+ already been submitted. When submitting a bug report, please include a
26
+ [Gist][gist] that includes a stack trace and any details that may be necessary
27
+ to reproduce the bug, including your gem version, Ruby version, and operating
28
+ system. Ideally, a bug report should include a pull request with failing tests.
29
29
 
30
30
  [gist]: https://gist.github.com/
31
31
 
32
32
  ## Submitting a Pull Request
33
- 1. [Fork the repository.][fork]
34
- 2. [Create a topic branch.][branch]
35
- 3. Add specs for your unimplemented feature or bug fix.
36
- 4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
37
- 5. Implement your feature or bug fix.
38
- 6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
39
- 7. Run `open coverage/index.html`. If your changes are not completely covered
40
- by your tests, return to step 3.
41
- 8. Add, commit, and push your changes.
42
- 9. [Submit a pull request.][pr]
33
+ 1. [Fork the repository.][fork]
34
+ 2. [Create a topic branch.][branch]
35
+ 3. Add tests for your unimplemented feature or bug fix.
36
+ 4. Run `bundle exec rake test`. If your tests pass, return to step 3.
37
+ 5. Implement your feature or bug fix.
38
+ 6. Run `bundle exec rake test`. If your tests fail, return to step 5.
39
+ 7. Run `open coverage/index.html`. If your changes are not completely covered
40
+ by your tests, return to step 3.
41
+ 8. Run `bundle exec rake mutant` and kill any surviving mutants.
42
+ 9. Run `bundle exec rake lint` and fix any offenses.
43
+ 10. Run `bundle exec rake yardstick` and add any missing documentation.
44
+ 11. Add, commit, and push your changes.
45
+ 12. [Submit a pull request][pr] that summarizes *what* changes you made and
46
+ *why* you made them. If you made any significant decisions along the way,
47
+ describe the options you considered and how you thought about the
48
+ tradeoffs.
43
49
 
44
50
  [fork]: http://help.github.com/fork-a-repo/
45
51
  [branch]: http://learn.github.com/p/branching.html
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # MultiJSON
2
2
 
3
3
  [![Gem Version](http://img.shields.io/gem/v/multi_json.svg)][gem]
4
- [![Build Status](https://github.com/sferik/multi_json/actions/workflows/ci.yml/badge.svg)][build]
4
+ [![Build Status](https://github.com/sferik/multi_json/actions/workflows/tests.yml/badge.svg)][build]
5
5
  [![Maintainability](https://qlty.sh/badges/fde3f4a8-c331-44be-b1e6-45842137def9/maintainability.svg)][qlty]
6
6
 
7
7
  Lots of Ruby libraries parse JSON and everyone has their favorite JSON coder.
@@ -41,12 +41,13 @@ which inherits from `ArgumentError`.
41
41
 
42
42
  MultiJSON tries to have intelligent defaulting. That is, if you have any of the
43
43
  supported engines already loaded, it will utilize them before attempting to
44
- load any. When loading, libraries are ordered by speed. First Oj, then Yajl,
45
- then the JSON gem. If no other JSON library is available,
44
+ load any. When loading, libraries are ordered by speed. First fast_jsonparser,
45
+ then Oj, then Yajl, then the JSON gem. If no other JSON library is available,
46
46
  MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
47
47
 
48
48
  ## Supported JSON Engines
49
49
 
50
+ - [fast_jsonparser][fast_jsonparser] Fast JSON parser by Anil Maurya
50
51
  - [Oj][oj] Optimized JSON by Peter Ohler
51
52
  - [Yajl][yajl] Yet Another JSON Library by Brian Lopez
52
53
  - [JSON][json-gem] The default JSON gem with C-extensions (ships with Ruby 1.9+)
@@ -98,9 +99,9 @@ spec.add_dependency 'multi_json', '~> 1.0'
98
99
  ## Copyright
99
100
 
100
101
  Copyright (c) 2010-2025 Michael Bleigh, Josh Kalderimis, Erik Berlin,
101
- and Pavel Pravosud. See [LICENSE][] for details.
102
+ and Pavel Pravosud. See [LICENSE][license] for details.
102
103
 
103
- [build]: https://github.com/sferik/multi_json/actions/workflows/ci.yml
104
+ [build]: https://github.com/sferik/multi_json/actions/workflows/tests.yml
104
105
  [gem]: https://rubygems.org/gems/multi_json
105
106
  [gson]: https://github.com/avsej/gson.rb
106
107
  [jrjackson]: https://github.com/guyboertje/jrjackson
@@ -110,6 +111,7 @@ and Pavel Pravosud. See [LICENSE][] for details.
110
111
  [macruby]: http://www.macruby.org/
111
112
  [oj]: https://github.com/ohler55/oj
112
113
  [okjson]: https://github.com/kr/okjson
114
+ [fast_jsonparser]: https://github.com/anilmaurya/fast_jsonparser
113
115
  [pvc]: http://docs.rubygems.org/read/chapter/16#page74
114
116
  [qlty]: https://qlty.sh/gh/sferik/projects/multi_json
115
117
  [semver]: http://semver.org/
@@ -2,54 +2,115 @@ require "singleton"
2
2
  require_relative "options"
3
3
 
4
4
  module MultiJson
5
+ # Base class for JSON adapter implementations
6
+ #
7
+ # Each adapter wraps a specific JSON library (Oj, JSON gem, etc.) and
8
+ # provides a consistent interface. Uses Singleton pattern so each adapter
9
+ # class has exactly one instance.
10
+ #
11
+ # Subclasses must implement:
12
+ # - #load(string, options) -> parsed object
13
+ # - #dump(object, options) -> JSON string
14
+ #
15
+ # @api private
5
16
  class Adapter
6
17
  extend Options
7
18
  include Singleton
8
19
 
9
20
  class << self
10
- BLANK_RE = /\A\s*\z/
11
- private_constant :BLANK_RE
21
+ BLANK_PATTERN = /\A\s*\z/
22
+ private_constant :BLANK_PATTERN
12
23
 
24
+ # Hook called when a subclass is created
25
+ #
26
+ # @api private
27
+ # @param subclass [Class] the new subclass
28
+ # @return [void]
29
+ def inherited(subclass)
30
+ super
31
+ # Propagate default options to subclasses
32
+ subclass.instance_variable_set(:@default_load_options, @default_load_options) if defined?(@default_load_options)
33
+ subclass.instance_variable_set(:@default_dump_options, @default_dump_options) if defined?(@default_dump_options)
34
+ end
35
+
36
+ # DSL for setting adapter-specific default options
37
+ #
38
+ # @api private
39
+ # @param action [Symbol] :load or :dump
40
+ # @param value [Hash] default options for the action
41
+ # @return [Hash] the frozen options hash
13
42
  def defaults(action, value)
14
- value.freeze
15
- define_singleton_method("default_#{action}_options") { value }
43
+ instance_variable_set(:"@default_#{action}_options", value.freeze)
16
44
  end
17
45
 
46
+ # Parse a JSON string into a Ruby object
47
+ #
48
+ # @api private
49
+ # @param string [String, #read] JSON string or IO-like object
50
+ # @param options [Hash] parsing options
51
+ # @return [Object, nil] parsed object or nil for blank input
18
52
  def load(string, options = {})
19
53
  string = string.read if string.respond_to?(:read)
20
- raise self::ParseError if blank?(string)
54
+ return nil if blank?(string)
21
55
 
22
- instance.load(string, cached_load_options(options))
56
+ instance.load(string, merged_load_options(options))
23
57
  end
24
58
 
59
+ # Serialize a Ruby object to JSON
60
+ #
61
+ # @api private
62
+ # @param object [Object] object to serialize
63
+ # @param options [Hash] serialization options
64
+ # @return [String] JSON string
25
65
  def dump(object, options = {})
26
- instance.dump(object, cached_dump_options(options))
66
+ instance.dump(object, merged_dump_options(options))
27
67
  end
28
68
 
29
69
  private
30
70
 
71
+ # Checks if the input is blank (nil or whitespace-only)
72
+ #
73
+ # @api private
74
+ # @param input [String, nil] input to check
75
+ # @return [Boolean] true if input is blank
31
76
  def blank?(input)
32
- input.nil? || BLANK_RE.match?(input)
33
- rescue ArgumentError # invalid byte sequence in UTF-8
77
+ input.nil? || BLANK_PATTERN.match?(input)
78
+ rescue ArgumentError
79
+ # Invalid byte sequence in UTF-8 - treat as non-blank
34
80
  false
35
81
  end
36
82
 
37
- def cached_dump_options(options)
38
- opts = options_without_adapter(options)
39
- OptionsCache.dump.fetch(opts) do
40
- dump_options(opts).merge(MultiJson.dump_options(opts)).merge!(opts)
83
+ # Merges dump options from adapter, global, and call-site
84
+ #
85
+ # @api private
86
+ # @param options [Hash] call-site options
87
+ # @return [Hash] merged options hash
88
+ def merged_dump_options(options)
89
+ cache_key = strip_adapter_key(options)
90
+ OptionsCache.dump.fetch(cache_key) do
91
+ dump_options(cache_key).merge(MultiJson.dump_options(cache_key)).merge!(cache_key)
41
92
  end
42
93
  end
43
94
 
44
- def cached_load_options(options)
45
- opts = options_without_adapter(options)
46
- OptionsCache.load.fetch(opts) do
47
- load_options(opts).merge(MultiJson.load_options(opts)).merge!(opts)
95
+ # Merges load options from adapter, global, and call-site
96
+ #
97
+ # @api private
98
+ # @param options [Hash] call-site options
99
+ # @return [Hash] merged options hash
100
+ def merged_load_options(options)
101
+ cache_key = strip_adapter_key(options)
102
+ OptionsCache.load.fetch(cache_key) do
103
+ load_options(cache_key).merge(MultiJson.load_options(cache_key)).merge!(cache_key)
48
104
  end
49
105
  end
50
106
 
51
- def options_without_adapter(options)
52
- options[:adapter] ? options.except(:adapter) : options
107
+ # Removes the :adapter key from options for cache key
108
+ #
109
+ # @api private
110
+ # @param options [Hash] original options
111
+ # @return [Hash] frozen options without :adapter key
112
+ def strip_adapter_key(options)
113
+ options.except(:adapter).freeze
53
114
  end
54
115
  end
55
116
  end