Yesterday afternoon I was playing around with ParseTree to see how hard it will be to make an Ambition-like plugin for DataMapper and I was surprised at how easy it was. Check this out:
http://gist.github.com/59274 Of course this needs work before it could be put into a plugin, including docs and specs -- I was going to lift some of the use cases from the Ambition and Ambitious ActiveRecord plugins. I'm almost certain work needs to be done to handle all the use cases, like if you wanted to use Time.now within the block I'm pretty sure it will blow up, but that shouldn't be too difficult to fix. DM actually has most of the functionality that Ambition provides built- in, so there wasn't much to do besides walking the sexp. The code above only deals with conditions, and I was thinking it should be possible to handle sort_by without using ParseTree at all. I was planning on actually writing a real Ambition-like plugin for DM after the spec/doc rewrites for dm-core 0.10 are done, but if anyone wants to take this idea and write such a plugin now, please be my guest. Dan (dkubb) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
