use_symbol_to_proc.md
August 2, 2017 ยท View on GitHub
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(john mary michael).map { |x| x.upcase }
#=> ["JOHN", "MARY", "MICHAEL"]
%w(john mary michael).map(&:upcase)
#=> ["JOHN", "MARY", "MICHAEL"]