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,075
  • 6
  • 39
  • 80

1 Answers1

3

It is the same as:

self.keywords = [title, author, description].map { |keyword| keyword.downcase }.join(' ')
Brad Werth
  • 16,916
  • 9
  • 62
  • 86