Possible Duplicate:
What does map(&:name) mean in Ruby?
What does the &:valid? found in the each mean?
I’ve seen .each do |r| or whatever, but not sure how this one works?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
&is called theto_procoperator. It expands the symbol (:valid?) into a Proc.So your example is equivalent to: