Module: Tsuga::Adapter::Sequel::Cluster::Scopes

Defined in:
lib/tsuga/adapter/sequel/cluster.rb

Instance Method Summary collapse

Instance Method Details

#at_depth(depth) ⇒ Object



30
31
32
# File 'lib/tsuga/adapter/sequel/cluster.rb', line 30

def at_depth(depth)
  where(depth: depth)
end

#in_tile(*tiles) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/tsuga/adapter/sequel/cluster.rb', line 34

def in_tile(*tiles)
  depths = tiles.map(&:depth).uniq
  if depths.length > 1
    raise ArgumentError, 'all tile must be at same depth'
  end
  where(tilecode: tiles.map(&:prefix))
end