-
-
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 Hash/Indexable#dig/dig? #6719
Conversation
It would be also great to have |
Thought we decided against this. It was @j8r that method would just produce insane types. |
@RX14 I understood differently, also according to your own #3536 (comment). I still see it as a very handy addition to stdlib and see no reason not to implement it. |
I was against a = {1 => [[1, 2], [3, 4]]}
p typeof(a.dig(1, 0)) # => Array(Int32)
p a.dig(1, 0) # => [1, 2]
p typeof(a.dig(1, 0, 1)) # => Int32
p a.dig(1, 0, 1) # => 2 So I see it as a very nice, convenient way, to traverse deep structures. Now we would just need to add it to |
Exactly.
Yes, please! 🎉 |
@Sija Do you want to add |
@asterite Sure, will do. |
hi @Sija , long time no c |
Is it GTG now? CI fails seems not related, btw. |
Hello? Is this got stalled for a reason? |
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.
GTG on my side. Maybe NamedTuple
should also have #dig
to traverse them directly.
@bcardiff I like it 👍, it's here in the last commit. |
@Sija CircleCI had a bad week in their servers. In darwin is still failing because it trying to compile the compiler with llvm 7, which is still not supported. The dependency of the formula is |
* Add Hash/Indexable#dig/dig? * Add JSON/YAML::Any#dig/dig? * Add NamedTuple#dig/dig?
Followup to #3536.