From: "Hanmac (Hans Mackowiak)" Date: 2013-11-08T05:41:50+09:00 Subject: [ruby-core:58231] [ruby-trunk - Feature #9095] Allow `Symbol#to_proc` to take arguments Issue #9095 has been updated by Hanmac (Hans Mackowiak). i did something similar to that there: https://bugs.ruby-lang.org/issues/9076#note-9 its more [1, 2, 3, 4].map &:to_s.(2) #=> ["1", "10", "11", "100"] but it can be also used as [1, 2, 3, 4].map &:to_s.(2).size #=> [1, 2, 2, 3] its similar in using Enumerator#lazy ---------------------------------------- Feature #9095: Allow `Symbol#to_proc` to take arguments https://bugs.ruby-lang.org/issues/9095#change-42812 Author: alexeymuranov (Alexey Muranov) Status: Open Priority: Normal Assignee: Category: Target version: =begin After discussing #9076, i've decided to propose this: class Symbol def to_proc(*args) proc do |x| x.public_send(self, *args) end end end p = :+.to_proc(1) p[2] # => 3 [1, 2, 3, 4].map &:to_s.to_proc(2) #=> ["1", "10", "11", "100"] This would allow constructing more kinds of procs without using literal blocks. =end -- http://bugs.ruby-lang.org/