Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
balvig committed Mar 13, 2016
1 parent d2c527b commit fa545c2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ print result.ingredient
#=> "sucre"
```

### Handling amounts

By default, Ingreedy will convert all amounts to a rational number:

```ruby
result = Ingreedy.parse("1 1/2 cups flour")
print result.amount
#=> 3/2
```

However, setting `Ingreedy.preverse_amounts = true`, will allow amounts
to be detected and returned as originally input:

```ruby
Ingreedy.preserve_amounts = true

result = Ingreedy.parse("1 1/2 cups flour")
print result.amount
#=> 1 1/2
```

[Live demo](http://hangryingreedytest.herokuapp.com/)

# Pieces of Flair
Expand Down

0 comments on commit fa545c2

Please sign in to comment.