Module: Sequel::Dataset::DeprecatedSingletonClassMethods

Defined in:
lib/sequel/dataset/deprecated_singleton_class_methods.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#extension(*a) ⇒ Object

Load the extension into a clone of the receiver.



10
11
12
13
14
# File 'lib/sequel/dataset/deprecated_singleton_class_methods.rb', line 10

def extension(*a)
  c = _clone(:freeze=>false)
  c.send(:_extension!, a)
  c.freeze
end

#with_extend(*mods, &block) ⇒ Object

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.



19
20
21
22
23
24
# File 'lib/sequel/dataset/deprecated_singleton_class_methods.rb', line 19

def with_extend(*mods, &block)
  c = _clone(:freeze=>false)
  c.extend(*mods) unless mods.empty?
  c.extend(DatasetModule.new(&block)) if block
  c.freeze
end