From: Robert Klemme Date: 2005-02-22T00:49:41+09:00 Subject: Re: YAML and hash "Navindra Umanee" schrieb im Newsbeitrag news:20050221101107.A14321@cs.mcgill.ca... > Robert Klemme wrote: > > I don't have much insight into YAML internals but you'll probably be able > > to do that with YAML#add_builtin_type or YAML#add_ruby_type > > http://www.ruby-doc.org/core/classes/YAML.html#M001712 > > I would hazard a guess that YAML is deferring to the Hash constructor > to create hashes. The Ruby Hash behaves the same way: > > irb(main):017:0> {1=>2, 1=>3} > => {1=>3} > > I had the idea that by changing the behaviour of Hash, the behaviour > of YAML would automatically change. Unfortunately, re-defining > Hash.store does not seem to be enough. > > Hash is implemented in C and all Hash creations/stores are handled by > rb_hash_aset. I can't figure how to redefine this in Ruby. That's why you have to work with YAML IMHO. robert