On Jan 28, 11:02 pm, "Sindre Aarsaether (somebee)" <[email protected]> wrote: > Ambition would clearly be the best, but until 1.9 supports parsetree > in some way I agree that it shouldn't go into core. If we need to pick > the best of the worst, I propose to define #| #& on hashes, and do it > this way: > > Model.all({:age.gte => 65} | {:age.lt => 65, :retired => true}) > Model.all({:age.lt => 65} & ({:donated => true} | {:admin => true})) > > I have experimented with it, and its easy to get working. > This allows for infinite nesting, short syntax, and does not break the > old one in any way. > If you're not keen on using bitwise-operators here, this can just as > well work with defining #and #or on Hash, but then you need some extra > brackets.
This is the approach Sequel takes, FWIW. If you don't use ParseTree, it's probably the most natural and intuitive syntax you'll get with ruby. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
