From: "mame (Yusuke Endoh)" Date: 2012-03-27T23:45:24+09:00 Subject: [ruby-core:43741] [ruby-trunk - Feature #5574][Assigned] Make arrays comparable Issue #5574 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to matz (Yukihiro Matsumoto) ---------------------------------------- Feature #5574: Make arrays comparable https://bugs.ruby-lang.org/issues/5574#change-25248 Author: tokland (Arnau Sanchez) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: Why are arrays not comparable? _Array_ already defines _<=>_, so it seems only natural to mix-in the _Comparable_ module.
> [1, 2] < [1, 1] 
NoMethodError: undefined method `<' for [1, 2]:Array

> Array.send(:include, Comparable)
> [1, 2] < [1, 1] 
=> false
This was already discussed in the mailing list a while ago and people agreed it would be useful: http://www.ruby-forum.com/topic/76535 -- http://bugs.ruby-lang.org/