multi_xml 0.9.0 → 0.9.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/multi_xml/version.rb +1 -1
- data/lib/multi_xml.rb +21 -31
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8e4560022692cf83853b50994663cbabfc0bdb943e78c4c2288dff38869bd08
|
|
4
|
+
data.tar.gz: d25368ffc55f43108708b46cc228e7d4506f44d61cb4d371cdb549fe36bfea2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82885e626a6961ffaa1f34d039ba1a4ac0017c917c46f8232413f020252f9b88873643e44ca7c2b5ad1a7e510c2bccaf3757c246c4c2df801600048ee440f4c1
|
|
7
|
+
data.tar.gz: 96ea0d4b0947cdeb5230f07687d94be756379a80db7f7fd5e0484ff5a2b1cbc3407eee3c2ea3dce6e49d2595b0daa2f5ab404d20fda5d71fc8dd9bc0bbc7a748
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
0.9.1
|
|
2
|
+
-----
|
|
3
|
+
* Fix `MultiXml.method(:load)` resolving to `Kernel#load`. The legacy `MultiXml` constant forwarded calls to `MultiXML` via `method_missing`, but `Module#method` doesn't consult `method_missing`, so `MultiXml.method(:load)` resolved to the inherited `Kernel#load` and crashed with `LoadError` when invoked. Replaces `method_missing` with explicit singleton-method forwarders for every public method on `MultiXML`, mirroring the [analogous fix in MultiJSON](https://github.com/sferik/multi_json/issues/66).
|
|
4
|
+
|
|
1
5
|
0.9.0
|
|
2
6
|
-----
|
|
3
7
|
* Add `MultiXML.with_parser` for fiber-local scoped parser overrides, matching `MultiJSON.with_adapter`. The override lives in `Fiber[:multi_xml_parser]`, so concurrent fibers and threads each see their own parser without racing on a shared module variable; nested calls save and restore the previous value.
|
data/lib/multi_xml/version.rb
CHANGED
data/lib/multi_xml.rb
CHANGED
|
@@ -157,45 +157,35 @@ require_relative "multi_xml/deprecated"
|
|
|
157
157
|
#
|
|
158
158
|
# Downstream code that still writes MultiXml.parse(...) or
|
|
159
159
|
# rescue MultiXml::ParseError continues to work, but emits a one-time
|
|
160
|
-
# deprecation warning pointing at MultiXML.
|
|
161
|
-
#
|
|
162
|
-
# access via {.const_missing}, so both dotted calls
|
|
163
|
-
# lookups (including rescue clauses) route through
|
|
160
|
+
# deprecation warning pointing at MultiXML. Each public method on
|
|
161
|
+
# {MultiXML} gets an explicit forwarder defined on this module, and
|
|
162
|
+
# constant access resolves via {.const_missing}, so both dotted calls
|
|
163
|
+
# and :: constant lookups (including rescue clauses) route through
|
|
164
|
+
# the canonical module.
|
|
164
165
|
#
|
|
165
166
|
# @api public
|
|
166
167
|
# @deprecated Use {MultiXML} (all-caps) instead. Will be removed in v1.0.
|
|
167
168
|
module MultiXml
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
# Forward every public method MultiXML exposes through an explicit
|
|
170
|
+
# singleton method on the legacy MultiXml module, so callers that
|
|
171
|
+
# capture the method as a Method object (``MultiXml.method(:load)``)
|
|
172
|
+
# find this forwarder instead of falling back to inherited methods like
|
|
173
|
+
# ``Kernel#load``. The earlier ``method_missing``-based shim left
|
|
174
|
+
# ``MultiXml.method(:load)`` resolving to ``Kernel#load`` (because
|
|
175
|
+
# ``Module#method`` doesn't consult ``method_missing``) so a captured
|
|
176
|
+
# ``MultiXml.method(:load)`` would interpret the XML payload as a file
|
|
177
|
+
# path and crash with ``LoadError``. Forwarding eagerly fixes the
|
|
178
|
+
# capture path while preserving the one-time deprecation warning each
|
|
179
|
+
# call emits.
|
|
180
|
+
(::MultiXML.public_methods - ::Module.public_methods).each do |forwarded|
|
|
181
|
+
define_singleton_method(forwarded) do |*args, **kwargs, &block|
|
|
177
182
|
::MultiXML.warn_deprecation_once(:multi_xml_constant,
|
|
178
183
|
"The MultiXml constant is deprecated and will be removed in v1.0. Use MultiXML instead.")
|
|
179
|
-
|
|
180
|
-
::MultiXML.public_send(name, *args, **kwargs, &block)
|
|
181
|
-
else
|
|
182
|
-
super
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
# rubocop:enable Naming/BlockForwarding, Style/ArgumentsForwarding
|
|
186
|
-
|
|
187
|
-
# Respond to any method {MultiXML} responds to
|
|
188
|
-
#
|
|
189
|
-
# @api public
|
|
190
|
-
# @param name [Symbol] method name
|
|
191
|
-
# @param include_private [Boolean] include private methods
|
|
192
|
-
# @return [Boolean] true if {MultiXML} responds to the method
|
|
193
|
-
# @example
|
|
194
|
-
# MultiXml.respond_to?(:parse) #=> true
|
|
195
|
-
def respond_to_missing?(name, include_private)
|
|
196
|
-
::MultiXML.respond_to?(name, include_private)
|
|
184
|
+
::MultiXML.public_send(forwarded, *args, **kwargs, &block)
|
|
197
185
|
end
|
|
186
|
+
end
|
|
198
187
|
|
|
188
|
+
class << self
|
|
199
189
|
# Resolve missing constants to their {MultiXML} counterparts
|
|
200
190
|
#
|
|
201
191
|
# The lookup is performed with ``inherit: false`` so a stray
|