Ruby 2.6: Add #to_h with block argument to Array, Enum, ENV, Hash and Struct#5494
Merged
headius merged 4 commits intojruby:ruby-2.6from Dec 18, 2018
Conversation
enebo
reviewed
Dec 3, 2018
Member
enebo
left a comment
There was a problem hiding this comment.
Single very minor change and it looks good!
kares
reviewed
Dec 4, 2018
6555e06 to
bdbad97
Compare
Contributor
|
MRI seems to have refactored rb_hash_set_pair (used in enum, hash, struct) where they have centralized checks for "wrong element type" and "element has wrong array length". |
Member
|
@lopex perhaps a good follow up commit? |
Contributor
|
@enebo yeah I'll do that, hopefuly on this weekend, and have some more things on the table regarding match data, and 2.6 String#split, etc |
…iven For more information, please see feature #15143.
… if given For more information, please see feature #15143.
…given For more information, please see feature #15143.
For more information, please see feature #15143.
bdbad97 to
4339982
Compare
Contributor
Author
Member
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi folks,
This PR implements another Ruby 2.6 feature: #to_h method in Array, Enumerable, ENV, Hash and Struct classes now can map their elements to new keys and values to a given block.
For more information, please see feature #15143 [1].
I believe all the related tests (MRI and ruby/spec) are passing:i [2], [3], [4], [5], [6], [7], [8], [9], [10], [11].
For reference, I include a link to the commit introducing the functionality in MRI. [12]
Thanks in advance for any feedback.