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?
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?
It is the same as:
self.keywords = [title, author, description].map { |keyword| keyword.downcase }.join(' ')