Sha256: e1decc3b4fc74db12f167c91282c71fc21d2baea2e0198fe21345cfd7662cff1
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
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, attribute, value) scope.where(attribute => value) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
datagrid-0.8.3 | lib/datagrid/drivers/mongo_mapper.rb |
datagrid-0.8.2 | lib/datagrid/drivers/mongo_mapper.rb |
datagrid-0.8.1 | lib/datagrid/drivers/mongo_mapper.rb |