A Better Way to Sort Ruby Objects: How our Put gem makes sorting by multiple conditions easy
29-Sep-2022 1058
I have a confession to make: I’ve been programming Ruby since 2004 and I still get tripped up whenever I encounter the <=> spaceship operator. As recently as this week, I’ve caught myself slowly and unconfidently working out the rules in my head: “okay, if the receiver is comparably greater than the argument, it should return -1, right?”To avoid this confusion, many Rubyists reach for the Enumerable.
A Better Way to Sort Ruby Objects: How our Put gem makes sorting by multiple conditions easy #ruby #rubydeveloper #rubyonrails #Better #Objects: #makes #sorting #multiple #conditions #gem https://rubyonrails.ba/link/a-better-way-to-sort-ruby-objects-how-our-put-gem-makes-sorting-by-multiple-conditions-easy