A bounded method!
The clamp method is defined in the Comparable module. It is used to bound a value. It is more efficient and explicit than the « classic » [[1, 3].max, 4].min.

The min and max arguments can be nil to indicate no limit.

A Range argument can be used.

⚠️ The Range must be inclusive. The type of object returned depends on arguments.

Link to Ruby documentation for clamp.