Enumerable in Rails: index_by and index_with
index_by()
Convert an enumerable to a hash, using the block result as the key and the element as the value.
Source: Enumerable: index_by
index_with(default = INDEX_WITH_DEFAULT)
Convert an enumerable to a hash, using the element as the key and the block result as the value.
Source: Enumerable: index_with
New to me. These seem nice, and a good replacement for some incantations with Hash[]
.