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)


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

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

Instance Method Details

#parseObject

Raises:

  • (TypeError)


87
88
89
90
# File 'lib/oj/json.rb', line 87

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

#sourceObject

Raises:

  • (TypeError)


82
83
84
85
# File 'lib/oj/json.rb', line 82

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