Module: RapidJSON::JSONGem

Defined in:
lib/rapidjson/json_gem.rb

Constant Summary collapse

GeneratorError =
RapidJSON::EncodeError

Class Method Summary collapse

Class Method Details

.dump(object, anIO = nil, limit = nil) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/rapidjson/json_gem.rb', line 59

def dump(object, anIO = nil, limit = nil)
  if anIO.nil? && limit.nil?
    DUMP_CODER.dump(object)
  else
    GEM.dump(object, anIO, limit)
  end
end

.generate(object, opts = nil) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/rapidjson/json_gem.rb', line 67

def generate(object, opts = nil)
  if opts.nil?
    GENERATE_CODER.dump(object)
  else
    GEM.generate(object, opts)
  end
end

.load(string, proc = nil, options = nil) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/rapidjson/json_gem.rb', line 43

def load(string, proc = nil, options = nil)
  if proc.nil? && options.nil?
    DEFAULT_CODER.load(string)
  else
    GEM.load(string, proc, options)
  end
end

.parse(string, opts = nil) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/rapidjson/json_gem.rb', line 51

def parse(string, opts = nil)
  if opts.nil?
    DEFAULT_CODER.load(string)
  else
    GEM.load(string, options)
  end
end