class Sequel::Dataset::DatasetModule
# SELECT id, name FROM table WHERE active ORDER BY id<br>DB.active.with_id_and_name.by_id
end
where :active, :active
select :with_id_and_name, :id, :name
order :by_id, :id
DB.extend_datasets do
For example:
named methods on the dataset instances which do specific actions.
It adds some helper methods inside the module that can define
and Dataset#with_extend to add dataset methods to classes.
This Module subclass is used by Database#extend_datasets
def self.def_dataset_caching_method(mod, meth)
def self.def_dataset_caching_method(mod, meth) mod.send(:define_method, meth) do |name, *args, &block| if block define_method(name){public_send(meth, *args, &block)} else key = :"_#{meth}_#{name}_ds" define_method(name) do cached_dataset(key){public_send(meth, *args)} end end end end