Module: MultiJson::Options Private

Included in:
MultiJson, Adapter
Defined in:
lib/multi_json/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 load/dump options

Supports static hashes or dynamic callables (procs/lambdas). Extended by both MultiJson (global options) and Adapter classes.

API:

  • private

Instance Method Summary collapse

Instance Method Details

#default_dump_optionsHash

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.

Get default dump options

Returns:

  • frozen empty hash

API:

  • private



60
61
62
# File 'lib/multi_json/options.rb', line 60

def default_dump_options
  @default_dump_options ||= EMPTY_OPTIONS
end

#default_load_optionsHash

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.

Get default load options

Returns:

  • frozen empty hash

API:

  • private



52
53
54
# File 'lib/multi_json/options.rb', line 52

def default_load_options
  @default_load_options ||= EMPTY_OPTIONS
end

#dump_optionsHash

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.

Get options for dump operations

Returns:

  • resolved options hash

API:

  • private



44
45
46
# File 'lib/multi_json/options.rb', line 44

def dump_options(...)
  resolve_options(@dump_options, ...) || default_dump_options
end

#dump_options=(options) ⇒ Hash, Proc

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.

Set options for dump operations

Parameters:

  • options hash or callable

Returns:

  • the options

API:

  • private



27
28
29
30
# File 'lib/multi_json/options.rb', line 27

def dump_options=(options)
  OptionsCache.reset
  @dump_options = options
end

#load_optionsHash

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.

Get options for load operations

Returns:

  • resolved options hash

API:

  • private



36
37
38
# File 'lib/multi_json/options.rb', line 36

def load_options(...)
  resolve_options(@load_options, ...) || default_load_options
end

#load_options=(options) ⇒ Hash, Proc

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.

Set options for load operations

Parameters:

  • options hash or callable

Returns:

  • the options

API:

  • private



17
18
19
20
# File 'lib/multi_json/options.rb', line 17

def load_options=(options)
  OptionsCache.reset
  @load_options = options
end