Too bad there is no `clamp` function for this https://stackoverflow.com/questions/12020787/is-there-a-limit-clamp-function-in-ruby