Class: Vcsmap::CsvWriter
- Inherits:
-
Object
- Object
- Vcsmap::CsvWriter
- Defined in:
- lib/vcsmap/csv_writer.rb
Instance Method Summary collapse
-
#initialize(plugin_name, plugin_header, data) ⇒ CsvWriter
constructor
A new instance of CsvWriter.
- #write! ⇒ Object
Constructor Details
#initialize(plugin_name, plugin_header, data) ⇒ CsvWriter
Returns a new instance of CsvWriter.
5 6 7 8 9 |
# File 'lib/vcsmap/csv_writer.rb', line 5 def initialize(plugin_name, plugin_header, data) @file_path = file_path(plugin_name) @header = header(plugin_header) @data = data end |
Instance Method Details
#write! ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/vcsmap/csv_writer.rb', line 11 def write! puts "Writing CSV to #{@file_path} ..." CSV.open(@file_path, 'wb', force_quotes: true) do |csv| csv << @header @data.each do |line| csv << line end end end |