ANN: Sequel 0.0.20 Released

Sequel version 0.0.20 has just been released. This release introduces
a new feature - filtering using closures. The idea was introduced by
Sam S., 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 :wink:
  • != 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

Sharon R. [email protected] 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 S., who wrote about it here:
http://substantiality.net/archives/2007/4/16/datamapper-part-xiv-finder-block

Very nice, thanks a lot for this useful library.