What is the meaning of the &: combination?


#1

Hi I looked around on the web and couldn't find a proper explanation.

can somebody please explain what adding the ampersand and the colon does to a method?
i.e.
what is the difference between:

xxx.map(.to_s)

xxx.map(:to_s)

and
xxx.map(&:to_s)

?

thanks


#2

@filiizhari,
Try a_google search
ruby map(&:to_s) site:stackoverflow.com
http://stackoverflow.com/questions/23041002/what-does-to-s-mean-in-b-mapto-s
http://stackoverflow.com/questions/1217088/what-does-mapname-mean-in-ruby?lq=1