Module: MultiXml Deprecated

Defined in:
lib/multi_xml.rb

Overview

Deprecated.

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. Each public method on MultiXML gets an explicit forwarder defined on this module, and constant access resolves via MultiXml.const_missing, so both dotted calls and :: constant lookups (including rescue clauses) route through the canonical module.

Class Method Summary collapse

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.

Examples:

MultiXml::Parsers::Ox  # returns MultiXML::Parsers::Ox

Parameters:

  • name (Symbol)

    constant name

Returns:

  • (Object)

    the resolved constant from MultiXML



202
203
204
205
206
# File 'lib/multi_xml.rb', line 202

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