This Module subclass is used by Model.dataset_module to add dataset methods to classes. It adds a couple of features standard Modules, allowing you to use the same subset method you can call on Model, as well as making sure that public methods added to the module automatically have class methods created for them.
Define a method in the module
# File lib/sequel/model/dataset_module.rb, line 42 def self.def_dataset_caching_method(mod, meth) mod.send(:define_method, meth) do |name, *args, &block| if block define_method(name){send(meth, *args, &block)} else key = :"_#{meth}_#{name}_ds" define_method(name) do cached_dataset(key){send(meth, *args)} end end end end
Store the model related to this dataset module.
# File lib/sequel/model/dataset_module.rb, line 13 def initialize(model) @model = model end
Alias for where.
# File lib/sequel/model/dataset_module.rb, line 18 def subset(name, *args, &block) where(name, *args, &block) end