Project

General

Profile

Actions

Feature #16667

open

Allow parameters to Symbol#to_proc and Method#to_proc

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

Status:
Open
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:

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0