module StateGeoTools::Toploader

Sometimes you want to pull some entries up.

Constants

TOPLOAD_ERROR

Public Instance Methods

topload_items(set, topload) click to toggle source
# File lib/state_geo_tools/toploader.rb, line 10
def topload_items(set, topload)
  topload.each do |x|
    raise(NotInSetError, "#{x} #{TOPLOAD_ERROR}") unless set.include?(x)
  end

  # If not in the topload set, offset the ordering by a few hundred so it
  # maintains its current order
  set.sort_by { |item| topload.index(item) || (500 + set.index(item)) }
end