Issue #10829 has been updated by Brandon Weaver. Have you seen Functors before? https://www.ruby-forum.com/topic/4402886 ---------------------------------------- Feature #10829: Add to_proc method to the Array class https://bugs.ruby-lang.org/issues/10829#change-53335 * 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/