README.md in smart_csv-0.0.5 vs README.md in smart_csv-0.0.6
- old
+ new
@@ -1,27 +1,35 @@
-== SmartCSV
+# SmartCSV
Extend CSV class.
This gem need header.
-== FOR EXAMPLE
+## 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}
+ 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
+## METHODS
* Create a new record
- @data.create("id"=> '13', "lastname" => '1992')
+ @data.create("id"=> '13', "lastname" => '1992')
+
* Select records
- @data.where('firstname' => 'One').where_not('id' => '4')
+ @data.where('firstname' => 'One').where_not('id' => '4')
+
* Update record
- @data.where('firstname' => 'One').first.update({"lastname" => "Seven", "wartosc" => 2012}) }
+ @data.where('firstname' => 'One').first.update({"lastname" => "Seven", "wartosc" => 2012}) }
+
* Delete all records
- @data.delete_all
+ @data.delete_all
+
* Delete all records from scope of condition
- @data.where({'firstname' => 'One'}).delete_all
+ @data.where('firstname' => 'One').delete_all
+
+* Select all records which have 'id' attribute greater than 2
+
+ @data.gt('id', 2)