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 =

ignore and move on

::JSON::Ext::Parser

Class Method Summary collapse

Class Method Details

.dump_default_optionsObject



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

def self.dump_default_options
  Oj::MimicDumpOption.new
end

.dump_default_options=(h) ⇒ Object



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

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

.generatorObject



75
76
77
# File 'lib/oj/json.rb', line 75

def self.generator()
  @@generator
end

.generator=(g) ⇒ Object



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

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

.parserObject



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

def self.parser()
  @@parser
end

.parser=(p) ⇒ Object



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

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