0

I'm new to Rails. I see some special characters.

&:frozen?

&:built?

The code is

[array].reject(&:frozen?)

[array].reject(&:built?)

I checked but I didn't see document for that.

What is the meaning? Thank you

vietstone
  • 8,784
  • 16
  • 52
  • 79
  • Reject is a kind of iterator and you sent a method ex. frozen? and it is applied to every element in arry. It is syntax sugar. – MC2DX Aug 08 '14 at 03:39
  • Also a duplicate of and is better answered in `http://stackoverflow.com/questions/1217088/what-does-mapname-mean-in-ruby`. – sawa Aug 08 '14 at 03:40
  • Is this really a duplicate? It seems to present a few additional questions such as what is `reject` for and what do the `built?` and `frozen?` methods do – JKillian Aug 08 '14 at 03:42
  • Eh, after reading the question again I only sort of agree with myself. I am personally curious what `built?` is for – JKillian Aug 08 '14 at 03:43
  • @JKillian It's just the pre-existing code that I read. – vietstone Aug 11 '14 at 12:23

0 Answers0