module Tsuga::Adapter::Mongoid::Cluster::ScopeMethods

Public Instance Methods

at_depth(depth) click to toggle source
# File lib/tsuga/adapter/mongoid/cluster.rb, line 17
def at_depth(depth)
  where(:depth => depth)
end
in_tile(*tiles) click to toggle source
# File lib/tsuga/adapter/mongoid/cluster.rb, line 21
def in_tile(*tiles)
  # where(:geohash.gte => sw, :geohash.lte => ne)
  depths = tiles.map(&:depth).uniq
  raise ArgumentError, 'all tiles must be at same depth' if depths.length > 1
  where(:tilecode.in => tiles.map(&:prefix))
end