Class RGhost::Grid::CSV
In: grid/csv_grid.rb
Parent: RGhost::Grid::Base

Grid::CSV allows you to import data from a csv file.

Example

 grid=Grid::CSV.new :width => 2
 grid.column :title => "User", :align => :right
 grid.column :title => "Password", :format => lambda{|v| (v.to_s == "x") ? "Yes" : "No"}
 grid.column :title => "UID", :width => 1
 grid.column :title => "GID"
 grid.column :title => "Gecos", :width => 2.5
 grid.column :title => "Home Dir", :width => 4
 grid.column :title => "Shell"
 grid.style  :bottom_lines
 grid.data("/etc/passwd",/:/)

Methods

data  

Public Instance methods

Use the filepath to indicate what will be the file and col_sep the column separate by Regexp or String. Looks it

 grid.data("/mydir/myfile.csv", ';')

using regular expression

 grid.data("/mydir/myfile.csv", /[^\w]/)

[Validate]