Module: MultiXml Deprecated
- Defined in:
- lib/multi_xml.rb
Overview
Use MultiXML (all-caps) instead. Will be removed in v1.0.
Backward-compatible alias for the legacy MultiXml constant name
Downstream code that still writes MultiXml.parse(...) or rescue MultiXml::ParseError continues to work, but emits a one-time deprecation warning pointing at MultiXML. The module forwards every method call to MultiXML via MultiXml.method_missing and resolves constant access via MultiXml.const_missing, so both dotted calls and :: constant lookups (including rescue clauses) route through the canonical module.
Class Method Summary collapse
-
.const_missing(name) ⇒ Object
Resolve missing constants to their MultiXML counterparts.
-
.method_missing(name, *args, **kwargs, &block) ⇒ Object
Forward method calls to MultiXML, emitting a one-time warning.
-
.respond_to_missing?(name, include_private) ⇒ Boolean
Respond to any method MultiXML responds to.
Class Method Details
.const_missing(name) ⇒ Object
Resolve missing constants to their MultiXML counterparts
The lookup is performed with inherit: false so a stray
top-level ::ParseError constant in the host process (Racc
defines one when Nokogiri is loaded) is correctly ignored. Enables
rescue MultiXml::ParseError and MultiXml::Parsers::Ox to keep
working during the deprecation cycle.
212 213 214 215 216 |
# File 'lib/multi_xml.rb', line 212 def const_missing(name) ::MultiXML.warn_deprecation_once(:multi_xml_constant, "The MultiXml constant is deprecated and will be removed in v1.0. Use MultiXML instead.") ::MultiXML.const_get(name, false) end |
.method_missing(name, *args, **kwargs, &block) ⇒ Object
Forward method calls to MultiXML, emitting a one-time warning
rubocop:disable Naming/BlockForwarding, Style/ArgumentsForwarding
176 177 178 179 180 181 182 183 184 |
# File 'lib/multi_xml.rb', line 176 def method_missing(name, *args, **kwargs, &block) ::MultiXML.warn_deprecation_once(:multi_xml_constant, "The MultiXml constant is deprecated and will be removed in v1.0. Use MultiXML instead.") if ::MultiXML.respond_to?(name) ::MultiXML.public_send(name, *args, **kwargs, &block) else super end end |