Module: JSON::ParserOptions

Defined in:
lib/json/common.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.prepare(opts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/json/common.rb', line 10

def prepare(opts)
  if opts[:object_class] || opts[:array_class]
    opts = opts.dup
    on_load = opts[:on_load]

    on_load = object_class_proc(opts[:object_class], on_load) if opts[:object_class]
    on_load = array_class_proc(opts[:array_class], on_load) if opts[:array_class]
    opts[:on_load] = on_load
  end

  if opts.fetch(:create_additions, false) != false
    opts = create_additions_proc(opts)
  end

  opts
end