From: jgomo3@... Date: 2020-03-03T15:40:19+00:00 Subject: [ruby-core:97346] [Ruby master Feature#16667] Allow parameters to Symbol#to_proc and Method#to_proc Issue #16667 has been updated by jgomo3 (Jes�s G�mez). Hanmac (Hans Mackowiak) wrote in #note-8: > @jgomo3 i found my old Symbol#call code > Great helper. Well, that is another way. So yes, the whole point of this ticket is to propose to allow that kind of expressions. In other words, to enable us programmers to prepare, to "partially" call, or to "curry" better the thing that would be a method call based on a symbol for any purpose. So e.g, using the extension designed by (Hans Mackowiak), my example use case would be: ```ruby ary.map(&:dig.(:thing, :id)) ``` And for getting the partial proc: ```ruby dig_thing_and_id = :dig.(:thing, :id).to_proc ``` And for comparison, the idea as I explained: ```ruby ary.map(&:dig.to_proc(:thing, :id)) dig_thing_and_id = :dig.to_proc(:thing, :id) ``` ---------------------------------------- Feature #16667: Allow parameters to Symbol#to_proc and Method#to_proc https://bugs.ruby-lang.org/issues/16667#change-84466 * Author: jgomo3 (Jes�s G�mez) * Status: Open * Priority: Normal ---------------------------------------- Allow parameters to Symbol#to_proc and Method#to_proc So we can say: ``` ruby ary.map(:dig.to_proc(:id)) ``` Instead of ``` ruby ary.map { |e| e.dig(:id) } ``` Oppening the posibilities to refine the `&` operator in the future, for something like: ``` ruby ary.map(&(:dig, :id)) ``` Related: * https://bugs.ruby-lang.org/issues/11161 * https://bugs.ruby-lang.org/issues/16435 -- https://bugs.ruby-lang.org/ Unsubscribe: