README.md in csv2hash-0.6.8 vs README.md in csv2hash-0.7.0

- old
+ new

@@ -24,12 +24,13 @@ * [Definition Rules](#definition-rules) * [Default rules values](#default-rules-values) * [define where your data are expected](#define-where-your-data-are-expected) * [Samples](#samples) * [[MAPPING] Validation of cells with defined precision](#mapping-validation-of-cells-with-defined-precision) - * [Auto discover position feature](#auto-discover-position-feature) + * [Auto discover position feature in Mapping](#auto-discover-position-feature-in-mapping) * [[COLLECTION] Validation of a collection (Regular CSV)](#collection-validation-of-a-collection-regular-csv) + * [Auto discover position feature in Collection](#auto-discover-position-feature-in-collection) * [Structure validation rules](#structure-validation-rules) * [CSV Headers](#csv-headers) * [Parser and configuration](#parser-and-configuration) * [Response](#response) * [Exception or Not !](#exception-or-not-) @@ -208,11 +209,11 @@ end end end ``` -### Auto discover position feature +### Auto discover position feature in Mapping This is a special feature for finding the Y index of row where you data start. For instance you have this following data : ``` |---------------|---------------|------|-----| @@ -240,10 +241,11 @@ ``` cell position: [[0, /Employment/],1], key: 'employment' ``` + ### [COLLECTION] Validation of a collection (Regular CSV) Consider the following CSV: ``` @@ -285,9 +287,37 @@ end end end end ``` + +### Auto discover position feature in Collection + +This is a special feature for finding a specific column index on header. For example you have the following data: + + +``` +| Name | Age | +|---------------|---------------| +| John Doe | 23 | +| Jane Doe | 28 | +| | | +| | | +``` + +You want to extract `Name` and 'Age' for all rows but you want the order of the columns to be able to change. +You change the position to the regex of column index you are looking for. So this how the position + +``` +cell position: 0, key: 'name' +``` + +can be change to + +``` +cell position: /Name/ key: 'name' +``` + ### Structure validation rules You may want to validate some structure, like min or max number of columns, definition accepts structure_rules as a key for the third parameter. Current validations are: :min_columns, :max_columns