From: 2851820660@... Date: 2015-07-09T05:11:42+00:00 Subject: [ruby-core:69908] [CommonRuby - Feature #10829] Add to_proc method to the Array class Issue #10829 has been updated by 11 22. http://www.software-rating.com/ http://www.smartlogi.com/ �� http://www.shareorder.com/ http://www.gzs168.com/ �� http://www.aimooimage.com/ http://www.chinatowngate.net/ http://www.inspiredhypnosis.co.uk/daocplat.html http://the303plan.com/tibiagoldforsale.html ---------------------------------------- Feature #10829: Add to_proc method to the Array class https://bugs.ruby-lang.org/issues/10829#change-53327 * Author: Ben Morgan * Status: Open * Priority: Normal * Assignee: ---------------------------------------- In ruby, we've all seen this shortcut: ```ruby user.posts.map(&:title) ``` The expanded version is: ```ruby user.posts.map { |post| post.title } ``` Sometimes, however, that method might take arguments. This feature proposal is to allow the `to_proc` shortcut to be able to respond to the `Array` class. This would allow developers to be able to use the shortcut to be able to pass in arguments. This can currently be done by reopening the `Array` class and supplying it with a `to_proc` method: ```ruby class Array def to_proc proc { |receiver| receiver.send *self } end end ``` This would allow this code to be able to run: ```ruby [1, 2, 3, 4, 5].map([:+, 3]) # => [4, 5, 6, 7, 8] ``` -- https://bugs.ruby-lang.org/