/usr/lib/ruby/vendor_ruby/sequel/model/dataset_module.rb is in ruby-sequel 4.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 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)
define_method(name){filter(*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
|