Module: JSON

Defined in:
ext/oj/mimic_json.c,
lib/oj/json.rb,
lib/oj/state.rb

Overview

A mimic of the json gem module.

Defined Under Namespace

Modules: Ext Classes: GenericObject

Constant Summary collapse

NaN =
0.0/0.0
Infinity =
1.0/0.0
MinusInfinity =
-1.0/0.0
PRETTY_STATE_PROTOTYPE =

Taken from the unit test. Note that items like check_circular? are not present.

Ext::Generator::State.from_state({
  :allow_nan             => false,
  :array_nl              => "\n",
  :ascii_only            => false,
  :buffer_initial_length => 1024,
  :depth                 => 0,
  :indent                => "  ",
  :max_nesting           => 100,
  :object_nl             => "\n",
  :space                 => " ",
  :space_before          => "",
})
SAFE_STATE_PROTOTYPE =
Ext::Generator::State.from_state({
:allow_nan             => false,
:array_nl              => "",
:ascii_only            => false,
:buffer_initial_length => 1024,
:depth                 => 0,
:indent                => "",
:max_nesting           => 100,
:object_nl             => "",
:space                 => "",
:space_before          => "",
})
FAST_STATE_PROTOTYPE =
Ext::Generator::State.from_state({
:allow_nan             => false,
:array_nl              => "",
:ascii_only            => false,
:buffer_initial_length => 1024,
:depth                 => 0,
:indent                => "",
:max_nesting           => 0,
:object_nl             => "",
:space                 => "",
:space_before          => "",
})
Parser =
::JSON::Ext::Parser

Class Method Summary collapse

Class Method Details

.dump_default_optionsObject



47
48
49
# File 'lib/oj/json.rb', line 47

def self.dump_default_options
  Oj::MimicDumpOption.new
end

.dump_default_options=(h) ⇒ Object



51
52
53
54
55
56
# File 'lib/oj/json.rb', line 51

def self.dump_default_options=(h)
  m = Oj::MimicDumpOption.new
  h.each do |k, v|
    m[k] = v
  end
end

.generatorObject



70
71
72
# File 'lib/oj/json.rb', line 70

def self.generator()
  @@generator
end

.generator=(g) ⇒ Object



66
67
68
# File 'lib/oj/json.rb', line 66

def self.generator=(g)
  @@generator = g
end

.parserObject



62
63
64
# File 'lib/oj/json.rb', line 62

def self.parser()
  @@parser
end

.parser=(p) ⇒ Object



58
59
60
# File 'lib/oj/json.rb', line 58

def self.parser=(p)
  @@parser = p
end