module Sequel::Dataset::DeprecatedSingletonClassMethods

This module implements methods to support deprecated use of extensions registered not using a module. In such cases, for backwards compatibility, Sequel has to use a singleton class for the dataset.

Public Instance Methods

extension(*a) click to toggle source

Load the extension into a clone of the receiver.

   # File lib/sequel/dataset/deprecated_singleton_class_methods.rb
10 def extension(*a)
11   c = _clone(:freeze=>false)
12   c.send(:_extension!, a)
13   c.freeze
14 end
with_extend(*mods, &block) click to toggle source

Extend the cloned of the receiver with the given modules, instead of the default approach of creating a subclass of the receiver’s class and including the modules into that.

   # File lib/sequel/dataset/deprecated_singleton_class_methods.rb
19 def with_extend(*mods, &block)
20   c = _clone(:freeze=>false)
21   c.extend(*mods) unless mods.empty?
22   c.extend(DatasetModule.new(&block)) if block
23   c.freeze
24 end

Private Instance Methods

_extension!(exts) click to toggle source

Load the extensions into the receiver.

   # File lib/sequel/dataset/deprecated_singleton_class_methods.rb
29 def _extension!(exts)
30   Sequel.extension(*exts)
31   exts.each do |ext|
32     if pr = Sequel.synchronize{EXTENSIONS[ext]}
33       pr.call(self)
34     else
35       raise(Error, "Extension #{ext} does not have specific support handling individual datasets (try: Sequel.extension #{ext.inspect})")
36     end
37   end
38   self
39 end