Class: RubyMaat::Output::CsvOutput
- Inherits:
-
Object
- Object
- RubyMaat::Output::CsvOutput
- Defined in:
- lib/ruby_maat/output/csv_output.rb
Overview
CSV output handler - formats and writes analysis results as CSV
Instance Method Summary collapse
-
#initialize(output_file = nil, max_rows = nil) ⇒ CsvOutput
constructor
A new instance of CsvOutput.
- #write(dataframe) ⇒ Object
Constructor Details
#initialize(output_file = nil, max_rows = nil) ⇒ CsvOutput
Returns a new instance of CsvOutput.
9 10 11 12 |
# File 'lib/ruby_maat/output/csv_output.rb', line 9 def initialize(output_file = nil, max_rows = nil) @output_file = output_file @max_rows = max_rows end |
Instance Method Details
#write(dataframe) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby_maat/output/csv_output.rb', line 14 def write(dataframe) # Convert dataframe to CSV output_stream = @output_file ? File.open(@output_file, "w") : $stdout begin write_csv(dataframe, output_stream) ensure output_stream.close if @output_file end end |