Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 298 Bytes

use_symbol_to_proc.md

File metadata and controls

12 lines (9 loc) · 298 Bytes

Use Symbol to_proc

The & calls to_procon the object, and passes it as a block to the method. The following calls are equivalent:

%w(jonh mary michael).map { |x| x.upcase }
#=> ["JONH", "MARY", "MICHAEL"]

%w(jonh mary michael).map(&:upcase)
#=> ["JONH", "MARY", "MICHAEL"]