From: grant@antiflux.org (Grant Hollingworth)
Subject: [sup-talk] [PATCH] return sources in id-order, with non-archived sources first
Date: Fri, 25 Jan 2008 10:04:22 -0500 [thread overview]
Message-ID: <1201272768-sup-3795@spooky.local> (raw)
In-Reply-To: <1201238649-sup-7598@south>
* William Morgan [Fri Jan 25 00:27:14 -0500 2008]:
> > + def sources
> > + ## favour the inbox by listing non-archived sources first
> > + @sources.values.sort_by {|s| s.id }.partition {|s| !s.archived? }.flatten
> > + end
>
> Why bother sorting by id at all? Why not just something like:
> @sources.values.sort_by { |s| s.archived? ? 0 : 1 }
I probably did that because it's likely that an inbox is the first source.
It's not really necessary. I think partition is clearer than sort_by in this
case.
How about changing @sources to an array?
next prev parent reply other threads:[~2008-01-25 15:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 17:06 Grant Hollingworth
2008-01-25 5:27 ` William Morgan
2008-01-25 15:04 ` Grant Hollingworth [this message]
2008-02-03 0:58 ` William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1201272768-sup-3795@spooky.local \
--to=grant@antiflux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox