Module: MultiXML::OptionsNormalization Private

Defined in:
lib/multi_xml/options_normalization.rb,
sig/multi_xml.rbs

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helpers for normalizing the options hash passed to parse

Lives in its own module (rather than inside ParseSupport, which is mixed into MultiXML's singleton class) so self inside these methods is OptionsNormalization rather than MultiXML. That separation is what lets mutation testing distinguish MultiXML.warn_deprecation_once(...) from self.warn_deprecation_once(...).

Class Method Summary collapse

Class Method Details

.normalize_symbolize_option(options) ⇒ Hash[Symbol, untyped]

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Translate the deprecated :symbolize_keys option to :symbolize_names

Parameters:

  • options (Hash[Symbol, untyped])

Returns:

  • (Hash[Symbol, untyped])


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/multi_xml/options_normalization.rb', line 28

def self.normalize_symbolize_option(options)
  return options unless options.key?(:symbolize_keys)

  MultiXML.warn_deprecation_once(:symbolize_keys_option,
    "The :symbolize_keys option is deprecated and will be removed in v1.0. Use :symbolize_names instead.")

  new_opts = options.dup
  legacy_value = new_opts.delete(:symbolize_keys)
  new_opts[:symbolize_names] = legacy_value unless new_opts.key?(:symbolize_names)
  new_opts
end