class Bake::Format::NDJSON
Attributes
Public Class Methods
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.24.0/lib/bake/format/ndjson.rb, line 11 def self.input(file) new(file) end
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.24.0/lib/bake/format/ndjson.rb, line 21 def initialize(file) @file = file end
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.24.0/lib/bake/format/ndjson.rb, line 15 def self.output(file, value) value.each do |item| file.puts(JSON.generate(item)) end end
Public Instance Methods
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.24.0/lib/bake/format/ndjson.rb, line 27 def each return to_enum unless block_given? @file.each_line do |line| yield JSON.parse(line) end end