C
ciconia
Sequel version 0.3.3 has just been released. This release includes
extensions for easily specifying relative time stamps and a simple
worker thread implementation for asynchronous processing.
Sequel is a lightweight ORM library for Ruby. Sequel provides thread
safety, connection pooling and a simple and expressive API for
constructing database queries and table schemas.
Following is a discussion of the changes:
=== Numeric Extensions
Sequel now includes extensions to the Numeric class to make it easier
to specify time units and relative time stamps. This feature is based
on the functionality provided in Rails. These extensions are disabled
by default. To enable numeric extensions, include the following in
your code:
Sequel::NumericExtensions.enable
You can easily specify time in minute, hour, day and week units:
1.minute #=> 60
2.hours #=> 7200
3.days #=> 3 * 86400
1.week #=> 7 * 86400
You can also specify time relative to the current time using #from_now
and #ago:
3.hours.from_now
1.week.ago
And also time relative to a given time stamp:
3.hours.before(t)
4.days.since(t)
=== Worker threads
Sequel now includes a worker thread implementation, which can be
useful in cases where you need to perform database operations while
iterating over records. Jobs are added to the worker by calling
Worker#add with a block:
worker = Sequel::Worker.new
Item.filter
active => true).each do |i|
worker.add {i.set
name => i.name.capitalize)}
end
worker.join
You can also have the worker wrap all its jobs with a transaction by
specifying a database when creating a new worker:
worker = Sequel::Worker.new(DB) #transaction is begun
Item.filter
active => true).each do |i|
worker.add {i.set
name => i.name.capitalize)}
end
worker.join # transaction is commited
=== More info
Sequel project page:
<http://code.google.com/p/ruby-sequel>
Sequel documentation:
<http://sequel.rubyforge.org>
Join the Sequel-talk group:
<http://groups.google.com/group/sequel-talk>
Install the gem:
sudo gem install sequel
Or check out the source and install manually:
svn co http://ruby-sequel.googlecode.com/svn/trunk sequel
cd sequel
rake install
extensions for easily specifying relative time stamps and a simple
worker thread implementation for asynchronous processing.
Sequel is a lightweight ORM library for Ruby. Sequel provides thread
safety, connection pooling and a simple and expressive API for
constructing database queries and table schemas.
Following is a discussion of the changes:
=== Numeric Extensions
Sequel now includes extensions to the Numeric class to make it easier
to specify time units and relative time stamps. This feature is based
on the functionality provided in Rails. These extensions are disabled
by default. To enable numeric extensions, include the following in
your code:
Sequel::NumericExtensions.enable
You can easily specify time in minute, hour, day and week units:
1.minute #=> 60
2.hours #=> 7200
3.days #=> 3 * 86400
1.week #=> 7 * 86400
You can also specify time relative to the current time using #from_now
and #ago:
3.hours.from_now
1.week.ago
And also time relative to a given time stamp:
3.hours.before(t)
4.days.since(t)
=== Worker threads
Sequel now includes a worker thread implementation, which can be
useful in cases where you need to perform database operations while
iterating over records. Jobs are added to the worker by calling
Worker#add with a block:
worker = Sequel::Worker.new
Item.filter
worker.add {i.set
end
worker.join
You can also have the worker wrap all its jobs with a transaction by
specifying a database when creating a new worker:
worker = Sequel::Worker.new(DB) #transaction is begun
Item.filter
worker.add {i.set
end
worker.join # transaction is commited
=== More info
Sequel project page:
<http://code.google.com/p/ruby-sequel>
Sequel documentation:
<http://sequel.rubyforge.org>
Join the Sequel-talk group:
<http://groups.google.com/group/sequel-talk>
Install the gem:
sudo gem install sequel
Or check out the source and install manually:
svn co http://ruby-sequel.googlecode.com/svn/trunk sequel
cd sequel
rake install