I'm looking for a way to simplify the code for the following logic:

1. Take a value that is either a nil or an empty string
2. Convert that value to an integer
3. Set zero values to the maximum value (empty string/nil are converted to 0 when cast as an int)
4. `.clamp` the value between a minimum and a maximum

Here's the long form that works:

```
minimum = 1
maximum = 10_000
value = value.to_i
value = maximum if value.zero?
value = value.clamp(minimum, maximum)

```

So for example, if `value` is `""`, I should get 10,000. If `value` is `"15"`, I should get 15. If `value` is `"45000"`, I should get `10000`.

Is there a way to shorten this logic, assuming that minimum and maximum are defined and that the default value is the maximum?

The biggest problem I've had in shortening it is that null-coalescing doesn't work on the zero, since Ruby considers zero a truthy value. Otherwise, it could be a one-liner.