From: Farrel Lifson Date: 2008-06-24T06:12:01+09:00 Subject: Suggestion: Enumerable#all?/any? with argument I was thinking about Enumerable (one of Ruby's more powerful modules) and I was wondering whether the following proposal to extend Enumerable#all?/any? would have any merit. In a nutshell I think any? and all? should take one argument which is then applied to each item using the === operator. For example: [ "one", 2, "three"].all?( String ) would return false, while [ 1, 100, 1000].any?( 50...150 ) would return true. In the case where both an argument and a block is supplied both the block and the argument would be applied to the item and the results of each operation would be combined with AND. For example: ["one", "two", "six"].all? ( String ) { |item| item.length == 3 } would return true while [ 1, 2, "3" ].any? ( String ) { |item| item.to_i > 4 } would return false. Anyone else see any merit in this? The expression [ "one", "two", "three" ].all? String just seems quite nice to me. Farrel