From: "Martin Dürst" Date: 2011-12-08T10:01:09+09:00 Subject: [ruby-core:41535] [ruby-trunk - Feature #5710][Closed] Enumerable#each( :method ) and Enumerable#map( :method ) Issue #5710 has been updated by Martin D��rst. Status changed from Open to Closed closed at request of submitter ---------------------------------------- Feature #5710: Enumerable#each( :method ) and Enumerable#map( :method ) http://redmine.ruby-lang.org/issues/5710 Author: Mat��as Battocchia Status: Closed Priority: Normal Assignee: Category: core Target version: #each and #map could accept an argument of class string or symbol and send it to the objects in the enumerable. An example: array = [ "bi", "tri", "quad" ] p array.each( :upcase! ) #=> [ "BI", "TRI", "QUAD" ] p array.map( :length ) #=> [ 2, 3, 4 ] It is the same --but succinctly-- as: array.each { | string | string.upcase! } array.map { | string | string.length } This abbreviation is useful for those simple cases when you need to call a method over, or retrieve the values of a property of a set of objects. -- http://redmine.ruby-lang.org