lib/mobility/backends/sequel.rb in mobility-0.7.6 vs lib/mobility/backends/sequel.rb in mobility-0.8.0
- old
+ new
@@ -1,20 +1,33 @@
module Mobility
module Backends
module Sequel
- def setup_query_methods(query_methods)
- setup do |attributes, options|
- extend(Module.new do
- define_method ::Mobility.query_method do
- super().with_extend(query_methods.new(attributes, options))
- end
- end)
- end
- end
-
def self.included(backend_class)
backend_class.include(Backend)
- backend_class.extend(self)
+ backend_class.extend(ClassMethods)
+ end
+
+ module ClassMethods
+ # @param [Symbol] name Attribute name
+ # @param [Symbol] locale Locale
+ def [](name, locale)
+ build_op(name.to_s, locale)
+ end
+
+ # @param [String] _attr Attribute name
+ # @param [Symbol] _locale Locale
+ # @return Op for this translated attribute
+ def build_op(_attr, _locale)
+ raise NotImplementedError
+ end
+
+ # @param [Sequel::Dataset] dataset Dataset to prepare
+ # @param [Object] predicate Predicate
+ # @param [Symbol] locale Locale
+ # @return [Sequel::Dataset] Prepared dataset
+ def prepare_dataset(dataset, _predicate, _locale)
+ dataset
+ end
end
end
end
end