Class: Bake::Format::NDJSON
- Inherits:
-
Object
- Object
- Bake::Format::NDJSON
- Defined in:
- lib/bake/format/ndjson.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Class Method Summary collapse
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(file) ⇒ NDJSON
constructor
A new instance of NDJSON.
Constructor Details
#initialize(file) ⇒ NDJSON
18 19 20 |
# File 'lib/bake/format/ndjson.rb', line 18 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
22 23 24 |
# File 'lib/bake/format/ndjson.rb', line 22 def file @file end |
Class Method Details
.input(file) ⇒ Object
11 12 13 |
# File 'lib/bake/format/ndjson.rb', line 11 def self.input(file) new(file) end |
.output(file, value) ⇒ Object
15 16 |
# File 'lib/bake/format/ndjson.rb', line 15 def self.output(file, value) end |
Instance Method Details
#each ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/bake/format/ndjson.rb', line 24 def each return to_enum unless block_given? @file.each_line do |line| yield JSON.parse(line) end end |