Class: GnCrossmap::Writer
- Inherits:
-
Object
- Object
- GnCrossmap::Writer
- Defined in:
- lib/gn_crossmap/writer.rb
Overview
Saves output from GN Resolver to disk
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(output_io, original_fields, output_name, with_classification = false) ⇒ Writer
constructor
A new instance of Writer.
- #write(record) ⇒ Object
Constructor Details
#initialize(output_io, original_fields, output_name, with_classification = false) ⇒ Writer
Returns a new instance of Writer.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/gn_crossmap/writer.rb', line 6 def initialize(output_io, original_fields, output_name, with_classification = false) @output_io = output_io @output_fields = output_fields(original_fields) @output_fields << :classification if with_classification @output = CSV.new(@output_io, col_sep: "\t") @output << @output_fields @output_name = output_name GnCrossmap.log("Open output to #{@output_name}") end |
Instance Method Details
#close ⇒ Object
21 22 23 24 |
# File 'lib/gn_crossmap/writer.rb', line 21 def close GnCrossmap.log("Close #{@output_name}") @output_io.close end |
#write(record) ⇒ Object
17 18 19 |
# File 'lib/gn_crossmap/writer.rb', line 17 def write(record) @output << record end |