fastruby / fast-ruby

:dash: Writing Fast Ruby :heart_eyes: -- Collect Common Ruby idioms.
https://github.com/fastruby/fast-ruby
5.67k stars 376 forks source link

Add Array#to_h comparison with several other implementations #183

Closed sebastian-palma closed 1 year ago

sebastian-palma commented 4 years ago

As Ruby 2.6 added support for executing a block when passed to to_h I think we can add it with the other implementations to achieve the same output.

Ruby on Rails also has a shorter way Enumerable#index_by which I didn't want to include, but it's worth mentioning for those working with the framework.