On Apr 9, 10:49 am, Shawn <[email protected]> wrote: > Sometimes when building a hash of conditions on which to filter a > dataset, I end up with an empty hash: > > attrs = {} > attrs[:year] = year if year > attrs[:state] = state if state > > # attrs == {} if !year and !state > > I'd like the dataset.filter method to accept an empty hash and yield > an unchanged dataset, so that I can simply pass in the hash and not > worry about whether it contains any conditions: > > ds.filter(attrs) #=> ds
Well, it can't return self, but it can return a direct clone. Try the patch at http://pastie.org/911966.txt and let me know if it has the functionality you had in mind. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" 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/sequel-talk?hl=en.
