Sha256: 81e9e9b57e19fcbd751ec5c0ce1364fecf39405e952d12218c703bca84a82d67

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

# Header Validations

When you are importing data, it can be important to verify that all required data is present, to ensure consistent quality when importing data.

You can use the `required_keys` option to specify an array of hash keys that you require to be present at a minimum for every data row (after header transformation).

If these keys are not present, `SmarterCSV::MissingKeys` will be raised to inform you of the data inconsistency.

## Example

```ruby
  options = {
    required_keys: [:source_account, :destination_account, :amount]
  }
  data = SmarterCSV.process("/tmp/transactions.csv", options)

  => this will raise SmarterCSV::MissingKeys if any row does not contain these three keys
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smarter_csv-1.12.0.pre1 docs/header_validations.md