class Finleap::Customers::Geo
Constants
- BERLIN_OFFICE_LAT
- BERLIN_OFFICE_LONG
Public Class Methods
in_range(distance_range = 100)
click to toggle source
distance_range default is 100 km
# File lib/finleap/customers/geo.rb, line 12 def self.in_range(distance_range = 100) berlin_office = Geokit::LatLng.new(BERLIN_OFFICE_LAT, BERLIN_OFFICE_LONG) Data.all.select do |customer| destination = Geokit::LatLng.new(customer['latitude'], customer['longitude']) berlin_office.distance_to(destination) <= distance_range end.sort_by { |customer| customer['user_id'] } end