YAML and :SortKeys in 1.8.3

J

Joel VanderWerf

What happened to this option in 1.8.3?

obj.to_yaml:)SortKeys => true)

as in:

irb(main):026:0> hh={"6"=>6, "11"=>11, "7"=>7}
=> {"11"=>11, "6"=>6, "7"=>7}
irb(main):027:0> puts(hh.to_yaml:)SortKeys => true))
"11": 11
"6": 6
"7": 7

The code in the yaml lib that tested for this option has been removed. I
liked it...
 
J

Joel VanderWerf

Joel said:
What happened to this option in 1.8.3?

obj.to_yaml:)SortKeys => true)

as in:

irb(main):026:0> hh={"6"=>6, "11"=>11, "7"=>7}
=> {"11"=>11, "6"=>6, "7"=>7}
irb(main):027:0> puts(hh.to_yaml:)SortKeys => true))
"11": 11
"6": 6
"7": 7

The code in the yaml lib that tested for this option has been removed. I
liked it...

Actually, I just reinstalled 1.8.2, and it doesn't sort by keys either
in this example. A better example is

puts(ENV.to_hash.to_yaml:)SortKeys => true))

In 1.8.3, the output is not sorted, but it is sorted in 1.8.2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top