Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #! /usr/bin/env ruby
  2.  
  3. location = [44.84044, -0.5805]
  4. stores = DriveStore.nearest_stores_from_location(location)
  5. data = stores.map do |s|
  6. {
  7. 'id' => s.store_import_id,
  8. 'type' =>'pickup',
  9. 'distance' => "#{Geocoder::Calculations.distance_between(location,s.location).round(2)} km",
  10. 'logo' => s.drive_brand.image,
  11. 'brand' => s.drive_brand_id,
  12. 'name' => s.name,
  13. 'latitude' => s.latitude,
  14. 'longitude' => s.longitude
  15. }
  16. end
  17. File.open('tmp/stores.yml', 'w') {|f| f.write data.to_yaml }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement