Class: Dap::Input::InputJSON
- Inherits:
-
Object
- Object
- Dap::Input::InputJSON
- Includes:
- FileSource
- Defined in:
- lib/dap/input.rb
Overview
JSON Input (line-delimited records)
Instance Attribute Summary
Attributes included from FileSource
Instance Method Summary collapse
-
#initialize(args) ⇒ InputJSON
constructor
A new instance of InputJSON.
- #read_record ⇒ Object
Methods included from FileSource
Constructor Details
#initialize(args) ⇒ InputJSON
Returns a new instance of InputJSON.
56 57 58 |
# File 'lib/dap/input.rb', line 56 def initialize(args) self.open(args.first) end |
Instance Method Details
#read_record ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/dap/input.rb', line 60 def read_record line = self.fd.readline rescue nil return Error::EOF unless line json = Oj.load(line.strip) rescue nil return Error::Empty unless json json end |