It compares only Sets. Other classes (in particular array) can not be compared and nil is returned.
The implementation of <, >, subset?, etc., could all depend on <=>, but it is more efficient to keep them as is. a < b can return false without having to know the reason (is it that a > b or do they both have distinct elements).
It compares only
Set
s. Other classes (in particular array) can not be compared andnil
is returned.The implementation of
<
,>
,subset?
, etc., could all depend on<=>
, but it is more efficient to keep them as is.a < b
can returnfalse
without having to know the reason (is it thata > b
or do they both have distinct elements).