Read the answers in the duplicate questions for the meaning and usage of &:...
. In this case, entries
is an array, and there are three methods map
, sort_by
, and map
chained. sort_by(&:last)
is equivalent to sort_by{|x| x.last}
. map(&:first)
is the same as map{|x| x.first}
. The reason the first map
does not use &:...
is because (i) the receiver of accept_entry
is not e
, and (ii) it takes an argument e
.