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 (https://github.com/sparklemotion/nokogiri/blob/master/ROADMAP.md) 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?