A Better Way to Sort Ruby Objects: How our Put gem makes sorting by multiple conditions easy

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 #gem

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles