Two Ruby tricks using method chaining and Procs
[1,2,3].each_with_object(1).map(&:+)
# => [2, 3, 4]
# Same outcome, even shorter
[1, 2, 3].map(&1.method(:+))
# => [2, 3, 4]
In his blog post In Ruby, &method passes you!, Andrew Grimm explains how this all works.