Module: MultiXML::Options Private

Included in:
MultiXML
Defined in:
lib/multi_xml/options.rb

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.

Mixin providing configurable parse options

Supports static hashes or dynamic callables (procs/lambdas). Extended into MultiXML so callers configure process-wide defaults via parse_options=.

Constant Summary collapse

EMPTY_OPTIONS =

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

Frozen empty hash used as the zero-default for parse options.

{}.freeze

Instance Method Summary collapse

Instance Method Details

#parse_optionsHash

Get options for parse operations

When @parse_options is a callable (proc/lambda), it's invoked with args as positional arguments — typically the call-site options hash. When it's a plain hash, args is ignored.

Examples:

MultiXML.parse_options  #=> {}

Parameters:

  • args (Array<Object>)

    forwarded to the callable, ignored otherwise

Returns:

  • (Hash)

    resolved options hash



35
36
37
# File 'lib/multi_xml/options.rb', line 35

def parse_options(*)
  resolve_options(@parse_options, *) || EMPTY_OPTIONS
end

#parse_options=(options) ⇒ Hash, Proc

Set options for parse operations

Examples:

MultiXML.parse_options = {symbolize_names: true}

Parameters:

  • options (Hash, Proc)

    options hash or callable

Returns:

  • (Hash, Proc)

    the options



20
21
22
# File 'lib/multi_xml/options.rb', line 20

def parse_options=(options)
  @parse_options = options
end