class Extract

Extract data into a in-memory table

Attributes

table[R]

In-memory table

Public Class Methods

new(src_type, headers, src_path) click to toggle source

Currently src_type only ‘csv’ is supported Headers true if source has column names in first row src_path is an absolute path to the csv file

# File lib/setl_tool/extract.rb, line 27
def initialize(src_type,
               headers,
               src_path)
  @src_type = src_type
  @headers = headers
  @src_path = src_path
end

Public Instance Methods

data() click to toggle source

Extract data from @src_type

# File lib/setl_tool/extract.rb, line 36
def data
  case @src_type
  when "csv"
    @table = CSV.read(@src_path,
                      :headers => @headers)
    # TODO FIX headers
    #@col_headers = @table.headers
    #if @headers
    #  @table.by_col!
    #@table.delete(0)
    #end
  else
    puts "xlsl"
  end
end