module Tsuga::Adapter::ActiveRecord::Cluster::Scopes

Public Instance Methods

at_depth(depth) click to toggle source
# File lib/tsuga/adapter/active_record/cluster.rb, line 34
def at_depth(depth)
  where(depth: depth)
end
in_tile(*tiles) click to toggle source

FIXME: this also is redundant with the mongoid adapter implementation

# File lib/tsuga/adapter/active_record/cluster.rb, line 39
def in_tile(*tiles)
  depths = tiles.map(&:depth).uniq
  raise ArgumentError, 'all tile must be at same depth' if depths.length > 1
  where(tilecode: tiles.map(&:prefix))
end
in_viewport(sw:nil, ne:nil, depth:nil) click to toggle source
# File lib/tsuga/adapter/active_record/cluster.rb, line 45
def in_viewport(sw:nil, ne:nil, depth:nil)
  tiles = Tsuga::Model::Tile.enclosing_viewport(point_sw: sw, point_ne: ne, depth: depth)
  in_tile(*tiles)
end