multi_json 1.21.0 → 1.21.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: 6eb65ee97a46816e1bfe43fbeff173a83846bb1ff85e3c5e4fe97c80cec4dacf
4
- data.tar.gz: 9eedd9bd17375a5540dc4878613a9165e49925d1997c24f4d9776f41efb1d7f0
3
+ metadata.gz: 7cffb1170fe976efac86851b47b4db7208fb1eefc745ea73e6cf4aaeb4aaa281
4
+ data.tar.gz: d5b3f218ad72f318eb5c86152c87005f27f7fc3b4b265561f1156092cbbd6c4b
5
5
  SHA512:
6
- metadata.gz: c727bce3f895367c1092319c4725dedde9252706cc6da7a5d8b1ef4bef5abb025869b7a04dc44218dfe53198b8da0c0c36e1d61037824a34a59dcfd78a030f68
7
- data.tar.gz: 2dc0b84560382d05f58549875227be1dbc32c274172f2c67e4c395f4baede84217061a10fcf22ebd078ce7e89fb25a88e067f7424b4bdd830c75081e96d2938f
6
+ metadata.gz: a61eb7a6f29720708c0944b8288ed8a9ce1917f76d9934f3f417935a606fa3da0c8e6e1b8158a57420c49b97ba617222ff3a5e1ed28bbfc23c7146f46e32d0ce
7
+ data.tar.gz: fc6f0c205a0c6a05740a08de6c3a27d59e482e64f179591b47a718a84d02b7d509e1ffd368d28c6d5edc88a454bb8ce4c64cd784d7283cc4353c82f7d1f2919d
@@ -10,7 +10,7 @@ module MultiJSON
10
10
  # Minor version number
11
11
  MINOR = 21 unless defined? MultiJSON::Version::MINOR
12
12
  # Patch version number
13
- PATCH = 0 unless defined? MultiJSON::Version::PATCH
13
+ PATCH = 1 unless defined? MultiJSON::Version::PATCH
14
14
  # Pre-release version suffix
15
15
  PRE = nil unless defined? MultiJSON::Version::PRE
16
16
 
data/lib/multi_json.rb CHANGED
@@ -272,52 +272,34 @@ require_relative "multi_json/deprecated"
272
272
  #
273
273
  # Downstream code that still writes ``MultiJson.parse(...)`` or
274
274
  # ``rescue MultiJson::ParseError`` continues to work, but emits a
275
- # one-time deprecation warning pointing at ``MultiJSON``. The module
276
- # forwards every method call to {MultiJSON} via {.method_missing} and
277
- # resolves constant access via {.const_missing}, so both dotted calls
278
- # and ``::`` constant lookups (including rescue clauses) route through
279
- # the canonical module.
275
+ # one-time deprecation warning pointing at ``MultiJSON``. Each public
276
+ # method on {MultiJSON} gets an explicit forwarder defined on this
277
+ # module, and constant access resolves via {.const_missing}, so both
278
+ # dotted calls and ``::`` constant lookups (including rescue clauses)
279
+ # route through the canonical module.
280
280
  #
281
281
  # @api public
282
282
  # @deprecated Use {MultiJSON} (all-caps) instead. Will be removed in v2.0.
283
283
  module MultiJson
284
- class << self
285
- # Forward method calls to {MultiJSON}, emitting a one-time warning
286
- #
287
- # Uses explicit ``*args, **kwargs, &block`` forwarding because
288
- # mutant's AST structure table on the current parser version does
289
- # not yet recognize ``...`` forwarding nodes, so the module would
290
- # crash mutation analysis. The rubocop exclusions below document
291
- # that intent.
292
- #
293
- # @api public
294
- # @return [Object] the delegated call's return value
295
- # @example
296
- # MultiJson.parse('{"a":1}') # delegates to MultiJSON.parse
297
- # rubocop:disable Naming/BlockForwarding, Style/ArgumentsForwarding
298
- def method_missing(name, *args, **kwargs, &block)
284
+ # Forward every public method MultiJSON exposes through an explicit
285
+ # singleton method on the legacy MultiJson module, so callers that
286
+ # capture the method as a Method object (``MultiJson.method(:load)``)
287
+ # find this forwarder instead of falling back to inherited methods like
288
+ # ``Kernel#load``. The earlier ``method_missing``-based shim left
289
+ # ``MultiJson.method(:load)`` resolving to ``Kernel#load`` (because
290
+ # ``Module#method`` doesn't consult ``method_missing``) and broke
291
+ # libraries (Sawyer, Octokit, Danger) that capture decoders as Method
292
+ # objects. Forwarding eagerly fixes the capture path while preserving
293
+ # the one-time deprecation warning each call emits.
294
+ (::MultiJSON.public_methods - ::Module.public_methods).each do |forwarded|
295
+ define_singleton_method(forwarded) do |*args, **kwargs, &block|
299
296
  ::MultiJSON.warn_deprecation_once(:multi_json_constant,
300
297
  "The MultiJson constant is deprecated and will be removed in v2.0. Use MultiJSON instead.")
301
- if ::MultiJSON.respond_to?(name)
302
- ::MultiJSON.public_send(name, *args, **kwargs, &block)
303
- else
304
- super
305
- end
306
- end
307
- # rubocop:enable Naming/BlockForwarding, Style/ArgumentsForwarding
308
-
309
- # Respond to any method {MultiJSON} responds to
310
- #
311
- # @api public
312
- # @param name [Symbol] method name
313
- # @param include_private [Boolean] include private methods
314
- # @return [Boolean] true if {MultiJSON} responds to the method
315
- # @example
316
- # MultiJson.respond_to?(:parse) #=> true
317
- def respond_to_missing?(name, include_private)
318
- ::MultiJSON.respond_to?(name, include_private)
298
+ ::MultiJSON.public_send(forwarded, *args, **kwargs, &block)
319
299
  end
300
+ end
320
301
 
302
+ class << self
321
303
  # Resolve missing constants to their {MultiJSON} counterparts
322
304
  #
323
305
  # Enables ``rescue MultiJson::ParseError`` and
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.21.0
4
+ version: 1.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -43,10 +43,10 @@ licenses:
43
43
  - MIT
44
44
  metadata:
45
45
  bug_tracker_uri: https://github.com/sferik/multi_json/issues
46
- changelog_uri: https://github.com/sferik/multi_json/blob/v1.21.0/CHANGELOG.md
47
- documentation_uri: https://www.rubydoc.info/gems/multi_json/1.21.0
46
+ changelog_uri: https://github.com/sferik/multi_json/blob/v1.21.1/CHANGELOG.md
47
+ documentation_uri: https://www.rubydoc.info/gems/multi_json/1.21.1
48
48
  rubygems_mfa_required: 'true'
49
- source_code_uri: https://github.com/sferik/multi_json/tree/v1.21.0
49
+ source_code_uri: https://github.com/sferik/multi_json/tree/v1.21.1
50
50
  wiki_uri: https://github.com/sferik/multi_json/wiki
51
51
  rdoc_options: []
52
52
  require_paths: