Bugs: Browse | Submit New | Admin

[#19039] [PATCH] Fix get_attribute in REXML::Attributes

Date:
2008-03-23 05:00
Priority:
3
Submitted By:
Federico Builes (febuiles)
Assigned To:
Yukihiro Matsumoto (matz)
Category:
Misc / Other Standard Library
State:
Open
Platform:
 
Summary:
[PATCH] Fix get_attribute in REXML::Attributes

Detailed description
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.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-11-07 23:13
Sender: Roger Pack

and this one and the other one, too?
Thank you!
-=R

Attached Files:

Name Description Download
fix_rexml_get_attribute.patch Fix for get_attribute Download

Changes:

Field Old Value Date By
assigned_toshyouhei2008-11-08 03:41shyouhei
File Added3502: fix_rexml_get_attribute.patch2008-03-23 05:00febuiles