Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

YAML and :SortKeys in 1.8.3

2 views
Skip to first unread message

Joel VanderWerf

unread,
Nov 23, 2005, 12:49:48 AM11/23/05
to

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...

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407


Joel VanderWerf

unread,
Nov 23, 2005, 1:00:30 AM11/23/05
to
Joel VanderWerf wrote:
> 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.

0 new messages