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



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

def self.dump_default_options
  Oj::MimicDumpOption.new
end

.dump_default_options=(h) ⇒ Object



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

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

.generatorObject



78
79
80
# File 'lib/oj/json.rb', line 78

def self.generator()
  @@generator
end

.generator=(g) ⇒ Object



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

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

.parserObject



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

def self.parser()
  @@parser
end

.parser=(p) ⇒ Object



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

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