Sha256: 4cec49c2ec513e2836f29f6aa156d133ef39f3e2777a501d1babbbc20e73b6b8
Contents?: true
Size: 940 Bytes
Versions: 6
Compression:
Stored size: 940 Bytes
Contents
module Sequel class Model # 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. class DatasetModule < ::Module # Store the model related to this dataset module. def initialize(model) @model = model end # Define a named filter for this dataset, see # Model.subset for details. def subset(name, *args, &block) @model.subset(name, *args, &block) end private # Add a class method to the related model that # calls the dataset method of the same name. def method_added(meth) @model.send(:def_model_dataset_method, meth) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems