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

Don't depend on methods provided by Rails.

Culprits: .present? and .try
parent 3375c03f
No related branches found
No related tags found
No related merge requests found
......@@ -59,11 +59,13 @@ module Geocoder::Result
private
def geolocalized?
try_to_extract('coordinates', geomlonlat).present?
!!try_to_extract('coordinates', geomlonlat)
end
def try_to_extract(key, nullable_hash)
nullable_hash.try(:[], key)
def try_to_extract(key, hash)
if hash.is_a?(Hash) and hash.include?(key)
hash[key]
end
end
end
end
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