Skip to content

Commit

Permalink
insert allow_empty? usage on readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Rynaro committed Oct 6, 2019
1 parent f7a4b1a commit 1d3751f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,28 @@ format: '%d/%m/%Y'
#<DateTime: 2018-01-01T00:00:00+00:00 ...>
```

## General Formats Properties

Sometimes we need to deal with some general patterns on third-party files. Like lacks of informations, or some unexpected exported data pattern.

#### Allow Empty

The `allow_empty?` property was designed to deal with randomic unexpected data exported from third-party. Like `DateTime` field that has ``%Y%m%d` format, but in third-party file, some lines cames with ` `, or `00000000`.

The common return when `allow_empty?` was marked on field, is `nil`.

##### Example

```yaml
fields:
- name: birthdate
range: 2..10
type: DateTime
formats:
allow_empty?: true
format: '%d/%m/%Y'
```

## Tests

Simple `rake spec`
Expand Down

0 comments on commit 1d3751f

Please sign in to comment.