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          => "",
})
State =

Ext

::JSON::Ext::Generator::State
Parser =
::JSON::Ext::Parser

Class Method Summary collapse

Class Method Details

.dump_default_optionsObject



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

def self.dump_default_options
  Oj::MimicDumpOption.new
end

.dump_default_options=(h) ⇒ Object



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

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

.generatorObject



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

def self.generator()
  @@generator
end

.generator=(g) ⇒ Object



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

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

.parserObject



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

def self.parser()
  @@parser
end

.parser=(p) ⇒ Object



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

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