module ZipSearch::ActsAsLocation::LocalInstanceMethods
Public Instance Methods
coordinates()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 68 def coordinates; [latitude, longitude] end
has_coordinates?()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 67 def has_coordinates?; !latitude.nil? && !longitude.nil? end
location()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 58 def location; Hash[ location_fields.map{|lf| [ lf, send(lf) ] } ] end
location_blank?()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 59 def location_blank?; location.values.reject(&:blank?).empty? end
location_fields()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 57 def location_fields; self.class.location_fields end
location_missing_any?()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 60 def location_missing_any?; location.values.select(&:blank?).any? end
should_geocode?()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 70 def should_geocode?; !has_coordinates? && !location_blank? end
should_reverse_geocode?()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 71 def should_reverse_geocode?; has_coordinates? && location_missing_any? end
to_sentence()
click to toggle source
# File lib/zip_search/acts_as_location.rb, line 62 def to_sentence return 'Location unavailable' if location_blank? location_fields.map{|lf| send(lf) }.reject(&:blank?).join(', ') end