class Transit::Unmarshaler::Json

@api private

Public Class Methods

new(io, opts) click to toggle source
# File lib/transit/unmarshaler/cruby/json.rb, line 38
def initialize(io, opts)
  @io = io
  @decoder = Transit::Decoder.new(opts)
  @parse_handler = ParseHandler.new
end

Public Instance Methods

read() { |decode| ... } click to toggle source

@see Reader#read

# File lib/transit/unmarshaler/cruby/json.rb, line 45
def read
  if block_given?
    @parse_handler.each {|v| yield @decoder.decode(v)}
  else
    @parse_handler.each {|v| return @decoder.decode(v)}
  end
  Oj.sc_parse(@parse_handler, @io) {|_stack|}
end