[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.
You can use HTML tags for formatting. Wrap code in <code> tags and multiple lines of code in <pre><code> tags.