How &: works? if it is a method, and where is it defined? It is rails addition to ruby obviously. -- Nibirutech CTO Eric.Archangel MSN: archangel_hzm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org QQ: 996252 GMAIL: eric.archangel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org BLOG: http://blog.sina.com.cn/gameloft --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Eric Archangel wrote:> How &: works? if it is a method, and where is it defined? > It is rails addition to ruby obviously.http://caboo.se/doc/classes/Symbol.html#M003931 Symbol#to_proc This is tricky thing to document. It exploits a ruby syntax quirk where prepending a & to a method argument calls "to_proc" on that object in an attempt to make it eligible to be a block. v.map(&:to_s) Is the same as: v.map { |i| i.to_s } -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---