0

I found this code in codeschool

self.keywords = [title, author, description].map(&:downcase).join(' ')

I know the result that can convert string to downcase, but What does this shorthand (&:downcase) mean?

rj487
  • 4,476
  • 6
  • 47
  • 88

1 Answers1

3

It is the same as:

self.keywords = [title, author, description].map { |keyword| keyword.downcase }.join(' ')
Brad Werth
  • 17,411
  • 10
  • 63
  • 88