ANN: Sequel 0.0.20 Released

S

Sharon Rosner

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-finder-block

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/svn/trunk sequel
cd sequel
rake install
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,262
Messages
2,571,053
Members
48,769
Latest member
Clifft

Latest Threads

Top