Issue #6425 has been updated by trans (Thomas Sawyer).


Btw, just thought of something that might be important here. Technically a YAML OMap type is written:

  --- !!omap
  - a: 1
  - b: 2

The additional array sequence ensures the order regardless of the parser. However, given Ruby's ordered hashes, it makes sense that it can handle both the array (sequence) and the hash (mapping) forms.

  
----------------------------------------
Bug #6425: Psych issue with !!omap
https://bugs.ruby-lang.org/issues/6425#change-26640

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/