Project

General

Profile

Bug #8301

REXML::Attributes#to_a

Added by ohai (Ippei Obayashi) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-04-20 trunk 40391) [x86_64-linux]
[ruby-dev:47277]

Description

添付したコード(attributs_to_a.rb)を実行すると、REXML::Attributes#to_a という名前から期待される結果は
[foo:att='1', bar:att='2', att='<', baz='4']
だと思うのですが、実際には
[{"foo"=>foo:att='1', "bar"=>bar:att='2', ""=>att='<'}, baz='4']
という結果になります。これは意図した結果ではないと思うのですがどうでしょうか。

添付したパッチで上の「期待される結果」になります。


Files

attributes_to_a.rb (263 Bytes) attributes_to_a.rb ohai (Ippei Obayashi), 04/20/2013 04:39 PM
attributes_to_a.patch (340 Bytes) attributes_to_a.patch ohai (Ippei Obayashi), 04/20/2013 04:39 PM

Updated by hsbt (Hiroshi SHIBATA) over 7 years ago

  • Assignee set to kou (Kouhei Sutou)
#2

Updated by kou (Kouhei Sutou) over 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40482.
Ippei, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/rexml/element.rb (REXML::Attributes#to_a): Support namespaced attributes. [ruby-dev:47277] [Bug #8301] Patch by Ippei Obayashi. Thanks!!!
  • test/rexml/test_attributes.rb (AttributesTester#test_to_a_with_namespaces): Add a test of the above change.

Updated by kou (Kouhei Sutou) over 7 years ago

テストを追加して取り込みました!

Also available in: Atom PDF