Exploring Ruby's `clamp` and `minmax` methods
I came across an interesting problem recently where I was given a value and an array of “buckets” and I basically needed to return which bucket the value was closest to.This made me extremely excited at the prospect of having a practical use case for Ruby’s Comparable.
Exploring Ruby's `clamp` and `minmax` methods #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/exploring-ruby-s-clamp-and-minmax-methods