This module provides facilities for creating tables from csv data.
Loads a CSV file directly into a Table using the FasterCSV library.
Example:
# treat first row as column_names table = Table.load('mydata.csv') # do not assume the data has column_names table = Table.load('mydata.csv',:has_names => false) # pass in FasterCSV options, such as column separators table = Table.load('mydata.csv',:csv_options => { :col_sep => "\t" })
# File lib/ruport/data/table.rb, line 169 def load(csv_file, options={},&block) get_table_from_csv(:foreach, csv_file, options,&block) end
Creates a Table from a CSV string using FasterCSV. See Table.load for additional examples.
table = Table.parse("a,b,c\n1,2,3\n4,5,6\n")
# File lib/ruport/data/table.rb, line 178 def parse(string, options={},&block) get_table_from_csv(:parse,string,options,&block) end
Generated with the Darkfish Rdoc Generator 2.