title: Why doesn't sort or the spaceship (flying saucer) operator (<=>) work on booleans in Ruby?
body: <p>In "<a href="https://stackoverflow.com/questions/14814966/is-it-possible-to-sort-a-list-of-objects-depending-on-if-the-individual-objects">Is it possible to sort a list of objects depending on if the individual object's response to a method?</a>", I discovered that the flying saucer doesn't work on booleans. </p>
  
  <p>Consider:</p>
  
  <p>Ruby 1.8.7:</p>
  
  <pre><code>[true, false].sort # =&gt; undefined method `&lt;=&gt;' for true:TrueClass (NoMethodError)
  true &lt;=&gt; false     # =&gt; undefined method `&lt;=&gt;' for true:TrueClass (NoMethodError)
  </code></pre>
  
  <p>Ruby 1.9.3:</p>
  
  <pre><code>[true, false].sort # =&gt; comparison of TrueClass with false failed (ArgumentError)
  true &lt;=&gt; false     # =&gt; nil
  true &lt;=&gt; true      # =&gt; 0
  false &lt;=&gt; true     # =&gt; nil
  </code></pre>
  
  <p>It may have something to do with true and false not having a canonical sort order, because which comes first? But, that sounds pretty weak to me. </p>
  
  <p>Is this a bug in <code>sort</code>?</p>