Class: Transit::Unmarshaler::Json Private
- Inherits:
-
Object
- Object
- Transit::Unmarshaler::Json
- Defined in:
- lib/transit/unmarshaler/cruby/json.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: ParseHandler
Instance Method Summary collapse
-
#initialize(io, opts) ⇒ Json
constructor
private
A new instance of Json.
- #read ⇒ Object private
Constructor Details
#initialize(io, opts) ⇒ Json
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Json.
38 39 40 41 42 |
# 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 |
Instance Method Details
#read ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 48 49 50 51 52 |
# 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 |