Class: JSON::Ext::Parser

Inherits:
Object
  • Object
show all
Defined in:
ext/oj/mimic_json.c,
lib/oj/json.rb

Overview

The JSON::Ext::Parser is a placeholder in the mimic JSON module used for compatibility only.

Instance Method Summary collapse

Constructor Details

#initialize(src) ⇒ Parser

Returns a new instance of Parser.

Raises:

  • (TypeError)


84
85
86
87
88
# File 'lib/oj/json.rb', line 84

def initialize(src)
  raise TypeError.new("already initialized") unless @source.nil?

  @source = src
end

Instance Method Details

#parseObject

Raises:

  • (TypeError)


96
97
98
99
100
# File 'lib/oj/json.rb', line 96

def parse()
  raise TypeError.new("already initialized") if @source.nil?

  JSON.parse(@source)
end

#sourceObject

Raises:

  • (TypeError)


90
91
92
93
94
# File 'lib/oj/json.rb', line 90

def source()
  raise TypeError.new("already initialized") if @source.nil?

  @source
end