Skip to content
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

Using ax_elements breaks empty Hash #9

Closed
abstiles opened this issue May 20, 2014 · 1 comment
Closed

Using ax_elements breaks empty Hash #9

abstiles opened this issue May 20, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@abstiles
Copy link

Doing require 'ax_elements' breaks the functionality of the built-in Hash type when given an empty list. Observe:

irb(main):001:0> Hash[[]]
=> {}
irb(main):002:0> require 'ax_elements'
=> true
irb(main):003:0> Hash[[]]
TypeError: can't convert Array to Hash (Array#to_hash gives Array)
        from (irb):3:in `[]'
        from (irb):3
        from /usr/bin/irb:12:in `<main>'

Notably, this also breaks the Nokogiri gem, which ends up raising this same error when using any of the xpath-like methods due to a call to Hash[] with a possibly empty list.

I am testing this with Ruby 2.0.0 and AXElements 6.0.0 running on OS X 10.9.

@abstiles abstiles closed this as completed Jun 5, 2014
@abstiles abstiles reopened this Jun 5, 2014
@ferrous26 ferrous26 self-assigned this Nov 5, 2014
@ferrous26 ferrous26 added this to the 7.0.0.pre2 milestone Nov 5, 2014
@ferrous26 ferrous26 added the bug label Nov 5, 2014
ferrous26 added a commit that referenced this issue Jan 11, 2015
The issue is that core Ruby functionality seems to depend on
Array#method_missing, which seems weird to me. However, such is the
case for now, so we should try to allow it to work when possible.
@ferrous26
Copy link
Member

Should be all fixed now. Available in v7.0.0.pre3

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

No branches or pull requests

2 participants