diff options
author | Jean Boussier <[email protected]> | 2024-10-25 19:20:00 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-10-26 18:44:15 +0900 |
commit | e136e552b659a67742b185b0dafbebe098fe5c31 (patch) | |
tree | c982faa1d71e66711ee75a1e300bea39ab2d7613 | |
parent | 8018a3121f8a516d2849475f965a1cf6038b5543 (diff) |
[ruby/json] Instantiate Parser with a kwsplat
Prior to 2.7.3, `JSON::Ext::Parser` would only take kwargs.
So if json_pure 2.7.4 is loaded with `json <= 2.7.2` (or stdlib)
it blows up.
Ref: https://github.com/ruby/json/issues/650
Fix: https://github.com/ruby/json/issues/651
https://github.com/ruby/json/commit/4d9dc98817
-rw-r--r-- | ext/json/lib/json/common.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb index 182bb1c0e0..5f86360e02 100644 --- a/ext/json/lib/json/common.rb +++ b/ext/json/lib/json/common.rb @@ -219,7 +219,12 @@ module JSON if opts.nil? Parser.new(source).parse else - Parser.new(source, opts).parse + # NB: The ** shouldn't be required, but we have to deal with + # different versions of the `json` and `json_pure` gems being + # loaded concurrently. + # Prior to 2.7.3, `JSON::Ext::Parser` would only take kwargs. + # Ref: https://github.com/ruby/json/issues/650 + Parser.new(source, **opts).parse end end |