class Sequel::Model::DatasetModule

This Module subclass is used by Model.dataset_module to add dataset methods to classes. In addition to the methods offered by Dataset::DatasetModule, it also automatically creates class methods for public dataset methods.

Public Class Methods

new(model) click to toggle source

Store the model related to this dataset module.

   # File lib/sequel/model/dataset_module.rb
12 def initialize(model)
13   @model = model
14 end

Public Instance Methods

subset(name, *args, &block) click to toggle source

Alias for where.

   # File lib/sequel/model/dataset_module.rb
17 def subset(name, *args, &block)
18   where(name, *args, &block)
19 end

Private Instance Methods

method_added(meth) click to toggle source

Add a class method to the related model that calls the dataset method of the same name.

Calls superclass method
   # File lib/sequel/model/dataset_module.rb
25 def method_added(meth)
26   @model.send(:def_model_dataset_method, meth) if public_method_defined?(meth)
27   super
28 end