Class: CA::CSVWriter
- Inherits:
-
Object
- Object
- CA::CSVWriter
- Defined in:
- lib/carray/io/csv.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Processor
Instance Method Summary collapse
-
#initialize(sep = ",", rs = $/, fill = "", &block) ⇒ CSVWriter
constructor
A new instance of CSVWriter.
- #write_file(table, filename, mode = "w") ⇒ Object
- #write_io(table, io) ⇒ Object
- #write_string(table, string) ⇒ Object
Constructor Details
#initialize(sep = ",", rs = $/, fill = "", &block) ⇒ CSVWriter
Returns a new instance of CSVWriter.
384 385 386 387 388 389 |
# File 'lib/carray/io/csv.rb', line 384 def initialize (sep=",", rs=$/, fill="", &block) @block = block @sep = sep @rs = rs @fill = fill end |
Instance Method Details
#write_file(table, filename, mode = "w") ⇒ Object
400 401 402 403 404 |
# File 'lib/carray/io/csv.rb', line 400 def write_file (table, filename, mode="w") open(filename, mode) { |io| return write_io(table, io) } end |
#write_io(table, io) ⇒ Object
391 392 393 |
# File 'lib/carray/io/csv.rb', line 391 def write_io (table, io) return Processor.new(table, io, @sep, @rs, @fill, &@block).run end |
#write_string(table, string) ⇒ Object
395 396 397 398 |
# File 'lib/carray/io/csv.rb', line 395 def write_string (table, string) write_io(table, StringIO.new(string)) return string end |