The current implementation of REXML::Attributes#get_attribute is supposed to work when the parameter's either a String
or another attribute. The problem is that it's not normalizing the param before trying to find it in the Hash, so it
won't find anything when param is an Attribute:
irb(main):125:0> doc = Document.new
irb(main):126:0> e = Element.new("elem")
irb(main):127:0> h = Attributes.new(e)
irb(main):117:0> a = Attribute.new("foo", "bar")
irb(main):118:0> b = Attribute.new("bla", "baz")
irb(main):128:0> h.add a
irb(main):129:0> h.add b
irb(main):130:0> h.get_attribute a
=> nil
This patch fixes this, getting the name out of the parameter first if it's an Attribute.
|