Class: FastererCSV::IOWriter
- Inherits:
-
Object
- Object
- FastererCSV::IOWriter
- Defined in:
- lib/fasterer_csv.rb
Instance Method Summary collapse
- #<<(row) ⇒ Object
-
#initialize(file, quot = '~', sep = ',', quotenum = false) ⇒ IOWriter
constructor
A new instance of IOWriter.
Constructor Details
#initialize(file, quot = '~', sep = ',', quotenum = false) ⇒ IOWriter
Returns a new instance of IOWriter.
280 281 282 |
# File 'lib/fasterer_csv.rb', line 280 def initialize(file, quot = '~', sep = ',', quotenum = false) @first = true; @io = file; @quot = quot; @sep = sep; @quotenum = quotenum end |
Instance Method Details
#<<(row) ⇒ Object
284 285 286 287 288 289 290 291 292 |
# File 'lib/fasterer_csv.rb', line 284 def <<(row) raise "can only write arrays! #{row.class} #{row.inspect}" unless row.is_a? Array if @first && row.is_a?(Row) self.<<(row.headers) end @first = false @io.syswrite FastererCSV::quot_row(row, @quot, @sep, @quotenum) row end |