From: Kevin Smith Date: 2001-01-07T04:48:49+09:00 Subject: [ruby-talk:8757] Backward Range implementation Here's what I came up with that seems to work. I didn't exhaustively test all the methods of Range, but I think I probably hit the ones that weren't working. Oh, I don't expect backward ranges to support exclusive mode (it seems unbalanced), so I didn't test that. Gotta love this language! Kevin ========================== class Range alias old_each each def each(&block) if (first > last) first.downto(last) { |element| yield element} return self end return old_each(&block) end alias old_equal === def ===(obj) if (first > last) return (last..first).old_equal(obj) end return old_equal(obj) end end