Sha256: 0695d60c24da828de30a481b2ae148c0035bc2d2f6ab9fee1b92907224c23cb3
Contents?: true
Size: 1015 Bytes
Versions: 5
Compression:
Stored size: 1015 Bytes
Contents
module Datagrid module Drivers class MongoMapper < AbstractDriver def self.match?(scope) return false unless defined?(::MongoMapper) if scope.is_a?(Class) scope.ancestors.include?(::MongoMapper::Document) else scope.is_a?(::Plucky::Query) end end def to_scope(scope) scope.where end def where(scope, condition) scope.where(condition) end def asc(scope, order) scope.sort(order.asc) end def desc(scope, order) scope.sort(order.desc) end def default_order(scope, column_name) has_column?(scope, column_name) ? column_name : nil end def greater_equal(scope, field, value) scope.where(field => {"$gte" => value}) end def less_equal(scope, field, value) scope.where(field => {"$lte" => value}) end def has_column?(scope, column_name) scope.key?(column_name) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems