From: "trans (Thomas Sawyer)" Date: 2012-05-15T08:45:05+09:00 Subject: [ruby-core:45047] [ruby-trunk - Bug #6425] Psych issue with !!omap Issue #6425 has been updated by trans (Thomas Sawyer). =begin Ah, the indention I added was the problem. Try: a = YAML.load %{ --- !!omap a: 1 b: 2 } a.class a.to_yaml As for a test case. Something like? class TestYAMLOMap < Test::Unit::TestCase def test_omap_round_trip a = YAML.load "--- !!omap\n"a: 1\nb: 2\n" s = a.to_yaml assert s.index('!!omap') end end Okay, it could be better, but it's a start. =end ---------------------------------------- Bug #6425: Psych issue with !!omap https://bugs.ruby-lang.org/issues/6425#change-26629 Author: trans (Thomas Sawyer) Status: Open Priority: Normal Assignee: Category: lib Target version: ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux] =begin Psych doesn't seem to know ordered map. It parses fine, but loose the type when round-tripped. a = YAML.load %{ --- !!omap a: 1 b: 2 } => {"a"=>1, "b"=>2} a.class => Hash puts a.to_yaml --- a: 1 b: 2 =end -- http://bugs.ruby-lang.org/