I have an instance variable `@limit` which must be greater than 0 and no greater than 20. I currently have code like this:

```
@limit = (params[:limit] || 10).to_i
@limit = 20 if @limit > 20
@limit = 0 if @limit < 0

```

This looks ugly. Is there a better way to restrict an integer to a range of values?