class Csv2schema::CSV

Public Class Methods

new(io) click to toggle source
# File lib/csv2schema/csv.rb, line 7
def initialize(io)
  @validator = Csv2schema::Validator.new(io)
  @column_headers = get_column_headers
  apply_formats
  apply_required
end

Private Instance Methods

get_column_headers() click to toggle source
# File lib/csv2schema/csv.rb, line 16
def get_column_headers
  headers = @validator.data.first
  Hash[headers.each_with_index.map { |col, i| [col, {'name' => col}] }]
end