Module: OnTheMap::GeoLocatable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/on_the_map/geo_locatable.rb
Instance Method Summary collapse
- #geocodable? ⇒ Boolean
- #geocoding? ⇒ Boolean
- #geolocatable? ⇒ Boolean
- #latitude ⇒ Object (also: #lat)
- #longitude ⇒ Object (also: #lng)
- #perform_geocoding ⇒ Object (also: #perform_geocoding!)
Instance Method Details
#geocodable? ⇒ Boolean
69 70 71 |
# File 'lib/on_the_map/geo_locatable.rb', line 69 def geocodable? !position && geolocatable? || address.changed? end |
#geocoding? ⇒ Boolean
82 83 84 |
# File 'lib/on_the_map/geo_locatable.rb', line 82 def geocoding? @geocoding_started == true end |
#geolocatable? ⇒ Boolean
73 74 75 |
# File 'lib/on_the_map/geo_locatable.rb', line 73 def geolocatable? address && address.geolocatable? end |
#latitude ⇒ Object Also known as: lat
57 58 59 60 |
# File 'lib/on_the_map/geo_locatable.rb', line 57 def latitude perform_geocoding unless position position[1].to_i if position end |
#longitude ⇒ Object Also known as: lng
63 64 65 66 |
# File 'lib/on_the_map/geo_locatable.rb', line 63 def longitude perform_geocoding unless position position[0].to_i if position end |
#perform_geocoding ⇒ Object Also known as: perform_geocoding!
77 78 79 |
# File 'lib/on_the_map/geo_locatable.rb', line 77 def perform_geocoding geocode if geocodable? && !geocoding? end |