← Graph

Symbol#to_proc

concept 1 connections

Ruby core method that returns a proc which, given an object as its first argument, sends the symbol's method to that object (with any additional args and block). Enables the `&:method_name` shortcut in `map`, `each`, etc. Małaszkiewicz walks through the Rubinius implementation: captures the symbol into an instance variable to escape the `instance_eval` self-change, then builds a proc that calls the method on `args.first` with the remaining args and an optional block, raising `ArgumentError` ('no receiver given') when called with no arguments.

category
pattern
about
Symbol#to_proc concept
Walks the Rubinius implementation of Symbol#to_proc.

Provenance

Read by
1 extraction