Adding #fetch support to XML::Node ? #765

andyw8 opened this Issue Sep 21, 2012 · 2 comments


None yet

2 participants

andyw8 commented Sep 21, 2012

The docs say

A Nokogiri::XML::Node may be treated similarly to a hash with regard to attributes.

but one thing I miss from this hash-like behaviour is #fetch, which would raise an error if the given key doesn't exist. This can be helpful for avoiding nils being inadvertently passed around, leading to hard-to-find bugs.

Would this be worth adding?


Howdy! Thanks for bringing this up.

If you take a look at the roadmap for Nokogiri 2.0 ( you'll see that we definitely want to make the Node API better, particularly around attribute-hashiness (also see issue #666).

I'll add a reference to this issue in the roadmap, and leave this open for now. Cool?

andyw8 commented Sep 22, 2012

Great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment