Sha256: b8e7b579f31665f9d942f4a420664d7e207b8712348110790c5e76059263e3fe

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

== SmartCSV

Extend CSV class.
This gem need header.

== FOR EXAMPLE

  data = "id,firstname,lastname\n1,One,One\n2,Two,Two\n4,One,Four\n5,One,Five"
  @data = CSV.parse(data, {:col_sep => ',', :headers => true}

== METHODS

* Create a new record
   @data.create("id"=> '13', "lastname" => '1992')

* Select records
   @data.where('firstname' => 'One').where_not('id' => '4')

* Update record
   @data.where('firstname' => 'One').first.update({"lastname" => "Seven", "wartosc" => 2012}) }

* Delete all records
   @data.delete_all

* Delete all records from scope of condition
   @data.where({'firstname' => 'One'}).delete_all

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_csv-0.0.5 README.md