On 3/23/07, David Vanderson <dvanderson / customink.com> wrote: > Hello, > > I've been having some trouble converting rexml documents to yaml and > back. See the following test case: > #!/usr/bin/env ruby > require 'yaml' > require 'rexml/document' > d = REXML::Document.new '<my_doc my_attr="my_val">Hello</my_doc>' > puts YAML::load(d.to_yaml) > > When I run it I get this error: > NoMethodError: undefined method `each_value' for "my_val":String > from /usr/lib/ruby/1.8/rexml/element.rb:1029:in `each_attribute' > from /usr/lib/ruby/1.8/rexml/element.rb:1025:in `each_attribute' > from /usr/lib/ruby/1.8/rexml/element.rb:684:in `write' > from /usr/lib/ruby/1.8/rexml/document.rb:165:in `write' > from /usr/lib/ruby/1.8/rexml/document.rb:163:in `write' > from /usr/lib/ruby/1.8/rexml/node.rb:23:in `to_s' > from (irb):5 > > I believe it has something to do with the REXML::Attributes class > extending Hash, so YAML::load produces just a Hash, without Attribute > objects inside. > > This is with: > ruby 1.8.4 (2005-12-24) [i386-linux] > > Can anyone else reproduce this? Get the same. Same version of ruby, though. T.