Project

General

Profile

Feature #16667

Allow parameters to Symbol#to_proc and Method#to_proc

Added by jgomo3 (Jesús Gómez) 4 months ago. Updated 4 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:97319]

Description

Allow parameters to Symbol#to_proc and Method#to_proc

So we can say:

ary.map(:dig.to_proc(:id))

Instead of

ary.map { |e| e.dig(:id) }

Oppening the posibilities to refine the & operator in the future, for something like:

ary.map(&(:dig, :id))

Related:

Also available in: Atom PDF