Skip to content
Snippets Groups Projects
Commit 6bef27f7 authored by Alex Reisner's avatar Alex Reisner
Browse files

Return nil unless object is geocoded.

parent 84ffa526
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,8 @@ module Geocoder
# See distance_to for various ways to specify the point.
#
def bearing_to(point, options = {})
return nil unless them = Geocoder::Calculations.extract_coordinates(point)
return nil unless geocoded? &&
them = Geocoder::Calculations.extract_coordinates(point)
us = to_coordinates
Geocoder::Calculations.bearing_between(
us[0], us[1], them[0], them[1], options)
......@@ -55,7 +56,8 @@ module Geocoder
# See distance_to for various ways to specify the point.
#
def bearing_from(point, options = {})
return nil unless them = Geocoder::Calculations.extract_coordinates(point)
return nil unless geocoded? &&
them = Geocoder::Calculations.extract_coordinates(point)
us = to_coordinates
Geocoder::Calculations.bearing_between(
them[0], them[1], us[0], us[1], options)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment