Comparable cho phép class định nghĩa thứ tự bằng cách implement duy nhất 1 method <=> (spaceship operator), sau đó nhận miễn phí: <, <=, >, >=, between?, clamp, và cả sort.
<=> trả 0 nếu bằng, -1 nếu nhỏ hơn, 1 nếu lớn hơn. Hình dung: ký <=> một lần, cả module Comparable làm phần còn lại.
Comparable allows a class to define ordering by implementing just one method <=> (the spaceship operator), then freely gets: <, <=, >, >=, between?, clamp, and sort.
<=> returns 0 if equal, -1 if less, 1 if greater. Mental model: implement <=> once, and the Comparable module handles the rest.