* 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?
_______________________________________________
sup-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to