Robert Klemme <bob.news / gmx.net> 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.

Cheers,
Navin.