-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Enumerable#to_h(&block) #7150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inefficient. You should create a Hash, call each and assume it's a tuple and add that to the hash.
9863fca
to
c8a14db
Compare
@asterite spot on, fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of U you can use Tuple(X, Y) forall X, Y and use those types to initialize the Hash.
I was thinking of that but then it would have to be |
Why Array? Tuple is enough. If you have an Array as the block value the caller can always convert that to a duple. Enforcing tuple guarantees a minimum level of performance. |
Fair 'nuff, pushed an update. |
Re: 🎄 shopping spree at Ruby 2.6 land ;)