ktheory/maildir — pull request #9 by s-s (2012-09-11 11:35:50+00:00)
Title: fix chronological order

Current ```Maildir#list``` returns files in wrong order because of microseconds. They are compared as unformatted strings, not integers.

Here is a small fix for this issue. Dunno what is better:

1) Change files' names for propper ordering (as in pull request):
```ruby
class Maildir::UniqueName
#...
def middle
"M#{'%06d' % microsecond}P#{process_id}Q#{delivery_count}"
end
#...
end
```

2) Or change the default sorting algorithm in ```Maildir#list``` to smth like this:

```ruby
keys.sort_by! { |k| k.sub(/^(\d+)\.M(\d+)(.+)$/) { "#{$1}.M#{'%06d' % $2.to_i}#{$3}" } }
```