[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ANN: Sequel 0.0.20 Released

Sharon Rosner

4/18/2007 8:58:00 PM

Sequel version 0.0.20 has just been released. This release introduces
a new feature - filtering using closures. The idea was introduced by
Sam Smoot, who wrote about it here:
http://substantiality.net/archives/2007/4/16/datamapper-part-xiv-fi...

I think it's a fantastic feature and makes filtering so much more
comfortable. Instead of doing stuff like:

items.filter('stamp < ?', 2.days.ago)

You can now say:

items.filter {stamp < 2.days.ago}

You can also use ranges, arrays, and subqueries:

items.filter {id == (5..30)} # parens needed because of operator
precedence

or items.filter {id.in 5..30}

And of course filters can be chained (both filter and exclude).

A few caveats:

* No support for field names starting with a capital letter.
* No support for nested expressions. Well, maybe in the future ;-)
* != operator should be written as <=>.

In other news, code coverage for the specs is at 85%, so version 0.1
is right around the corner.

======================

Install the gem:

sudo gem install sequel

Or check out the source and install locally:

svn co http://ruby-sequel.googlecode.com... sequel
cd sequel
rake install


1 Answer

Christian Neukirchen

4/19/2007 5:01:00 PM

0

Sharon Rosner <ciconia@gmail.com> writes:

> Sequel version 0.0.20 has just been released. This release introduces
> a new feature - filtering using closures. The idea was introduced by
> Sam Smoot, who wrote about it here:
> http://substantiality.net/archives/2007/4/16/datamapper-part-xiv-fi...

Very nice, thanks a lot for this useful library.

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneuk...