Class: StreamLines::Reading::JSONLines
- Inherits:
-
Object
- Object
- StreamLines::Reading::JSONLines
- Includes:
- Enumerable
- Defined in:
- lib/stream_lines/reading/json_lines.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(url, encoding: Encoding.default_external, **json_options) ⇒ JSONLines
constructor
A new instance of JSONLines.
Constructor Details
#initialize(url, encoding: Encoding.default_external, **json_options) ⇒ JSONLines
Returns a new instance of JSONLines.
11 12 13 14 15 |
# File 'lib/stream_lines/reading/json_lines.rb', line 11 def initialize(url, encoding: Encoding.default_external, **) @url = url @json_options = @stream = Stream.new(url, encoding: encoding) end |
Instance Method Details
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/stream_lines/reading/json_lines.rb', line 17 def each(&block) @stream.each { |line| block.call(parse_line(line)) } end |