On Mon, Feb 18, 2013 at 6:42 PM, Jack V. <[email protected]> wrote:
> I would just create an array containing the parts you want to compare:
>
> objects.sort { |a,b| [a.lastname, a.firstname] <=> [b.lastname,
> b.firstname] }
In theory this is less efficient since there are two Array instances
created per comparison. If you go for the Array solution, using
#sort_by is probably better:
objects.sort_by {|a| [a.lastname, a.firstname]}
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
--
[email protected] |
https://groups.google.com/d/forum/ruby-talk-google?hl=en
---
You received this message because you are subscribed to the Google Groups
"ruby-talk-google" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.