Class: InCSV::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/incsv/schema.rb

Overview

Given a CSV file, samples data from it in order to establish what data types its columns are.

Instance Method Summary collapse

Constructor Details

#initialize(csv) ⇒ Schema

Returns a new instance of Schema.


7
8
9
# File 'lib/incsv/schema.rb', line 7

def initialize(csv)
  @csv = csv
end

Instance Method Details

#columnsObject

Returns the column types found in the CSV. Memoises the result, so can be called repeatedly.


13
14
15
# File 'lib/incsv/schema.rb', line 13

def columns
  @columns ||= parsed_columns
end