Ticket #3 (assigned enhancement)
bring back sorted hash keys
| Reported by: | vjoel@… | Owned by: | why |
|---|---|---|---|
| Priority: | major | Milestone: | milestone1 |
| Component: | component2 | Version: | |
| Keywords: | to_yaml sort sortkeys hash | Cc: |
Description
After upgrading from ruby-1.8.2 to ruby-1.8.4, the readability of my yaml files decreased due #to_yaml ignoring :SortKeys?.
irb(main):006:0> puts h.to_yaml
---
5: 5
1: 1
2: 2
3: 3
4: 4
=> nil
irb(main):007:0> h
=> {5=>5, 1=>1, 2=>2, 3=>3, 4=>4}
irb(main):008:0> puts h.to_yaml(:SortKeys=>true)
---
5: 5
1: 1
2: 2
3: 3
4: 4
=> nil
I suggest that sorting keys should either be automatic or optional.
Change History
Note: See
TracTickets for help on using
tickets.