Just curious what people's opinions are on trimming items from an
array. In my case this is an array of objects, not just a simple array
of integers or something.
Here are a few possibilities..
$A([1, 2, 3 4, 5]).collect(function(item){ if (item != 4) return true;
}).compact(); // I'm concerned about this solution, for
performance/memory reasons on a collection of large objects
$A([1, 2, 3, 4, 5]).without(4); // not sure how this would work on a
collection of objects
$A([1, 2, 3, 4, 5]).reject(function(item{ if (item == 4) return true;
}); // nice since I don't have to compact
Here's a really contrived example of my usage: http://pastie.textmate.org/192080
Thanks for reading.
-justin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---