Implement Enumerable#to_h from 2.1. Tests from MRI. Fixes #2315.