Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Different behavior to Ruby 2.3.0's dig #5

Open
agross opened this issue Jun 27, 2016 · 5 comments
Open

Different behavior to Ruby 2.3.0's dig #5

agross opened this issue Jun 27, 2016 · 5 comments

Comments

@agross
Copy link

agross commented Jun 27, 2016

ruby_dig under 2.2.4

require 'ruby_dig'
{ foo: "bar" }.dig(:foo, :baz)
# => nil

Ruby 2.3.0

{ foo: "bar" }.dig(:foo, :baz)
# => TypeError: String does not have #dig method
@ColinDKelley
Copy link
Contributor

It's true. The Ruby 2.3 version of dig is sadly (IMO) useless because of
this. You will get similar exceptions if you try to dig into an Array with
a hash key. :(

On Mon, Jun 27, 2016 at 9:54 AM, Alexander Groß notifications@github.com
wrote:

ruby_dig under 2.2.4

require 'ruby_dig'
{ foo: "bar" }.dig(:foo, :baz)# => nil

Ruby 2.3.0

{ foo: "bar" }.dig(:foo, :baz)# => TypeError: String does not have #dig method


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#5, or mute the thread
https://github.com/notifications/unsubscribe/AAKKb8A2Rw_nOj54YS47eiN9tq9pwLYaks5qQABNgaJpZM4I_S0X
.

@agross
Copy link
Author

agross commented Jun 27, 2016

Seconded! My concise dig invocations need to be replaced by fetch(:key, {}) or otherwise convoluted code, now that I tried to run my code against 2.3.

For the sake of the spare time of other developers, I would rather have the ruby_dig gem be compatible with Ruby >= 2.3 or be removed/yanked. I need to change lots of code now because the dig flavor provided by the gem is not as portable as I thought.

@ColinDKelley
Copy link
Contributor

I agree.

I don't have the time to change this gem to be compatible, but if you'd
like to do that I'd be happy to accept the PR. Or I can just yank the gem.

-Colin

On Mon, Jun 27, 2016 at 10:35 AM, Alexander Groß notifications@github.com
wrote:

Seconded! My concise dig invocations need to be replaced by fetch(:key,
{}) or otherwise convoluted code, now that I tried to run my code against
2.3.

For the sake of the spare time of other developers, I would rather have
the ruby_dig gem be compatible with Ruby >= 2.3 or be removed/yanked. I
need to change lots of code now because the dig flavor provided by the
gem is not as portable as I thought.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#5 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAKKb82bjgHniSY2o6xSlToBgT7HFX3yks5qQAnHgaJpZM4I_S0X
.

@agross
Copy link
Author

agross commented Jun 27, 2016

I don't have the time to change this gem to be compatible, but if you'd like to do that I'd be happy to accept the PR.

There actually is an open PR with the fix. Haven't checked it w.r.t. to compatibility, though.
#4

@ColinDKelley
Copy link
Contributor

Oh, thanks, I lost track of that PR but will try to check it out this week.

-Colin

On Mon, Jun 27, 2016 at 1:50 PM, Alexander Groß notifications@github.com
wrote:

I don't have the time to change this gem to be compatible, but if you'd
like to do that I'd be happy to accept the PR.

There actually is an open PR with the fixed. Haven't checked it w.r.t. to
compatibility, though.
#4 #4


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#5 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAKKb4efBNpRShp5KOtU6oVu0xq6t2z0ks5qQDeAgaJpZM4I_S0X
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants