Class

CSV::Reader

Inheritance
< Object
Included Modules
Enumerable

CSV formatted string/stream reader.

EXAMPLE

  read CSV lines untill the first column is 'stop'.

  CSV::Reader.parse(File.open('bigdata', 'rb')) do |row|
    p row
    break if !row[0].is_null && row[0].data == 'stop'
  end

Methods

Class

Visibility Signature
public create (str_or_readable, fs = ',', rs = nil)
public new (dev)
public parse (str_or_readable, fs = ',', rs = nil) {|row| ...}

Instance

Visibility Signature
public close ()
public each () {|row| ...}
public shift ()

Class Method Detail

create(str_or_readable, fs = ',', rs = nil)

Returns reader instance.

new(dev)

parse(str_or_readable, fs = ',', rs = nil) {|row| ...}

Parse CSV data and get lines. Given block is called for each parsed row. Block value is always nil. Rows are not cached for performance reason.

Instance Method Detail

close()

each() {|row| ...}

shift()