Class: CA::CSVReader
- Inherits:
-
Object
- Object
- CA::CSVReader
- Defined in:
- lib/carray/io/csv.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Processor
Instance Method Summary collapse
-
#initialize(sep = ",", rs = $/, &block) ⇒ CSVReader
constructor
A new instance of CSVReader.
- #read_file(filename) ⇒ Object
- #read_io(io) ⇒ Object
- #read_string(string) ⇒ Object
Constructor Details
#initialize(sep = ",", rs = $/, &block) ⇒ CSVReader
Returns a new instance of CSVReader.
77 78 79 80 81 |
# File 'lib/carray/io/csv.rb', line 77 def initialize (sep=",", rs=$/, &block) @block = block @sep = sep @rs = rs end |
Instance Method Details
#read_file(filename) ⇒ Object
91 92 93 94 95 |
# File 'lib/carray/io/csv.rb', line 91 def read_file (filename) open(filename) { |io| return read_io(io) } end |
#read_io(io) ⇒ Object
83 84 85 |
# File 'lib/carray/io/csv.rb', line 83 def read_io (io) return Processor.new(io, @sep, @rs, &@block).run end |
#read_string(string) ⇒ Object
87 88 89 |
# File 'lib/carray/io/csv.rb', line 87 def read_string (string) return read_io(StringIO.new(string)) end |