lib/jekyll-maps/location_finder.rb in jekyll-maps-2.0.0 vs lib/jekyll-maps/location_finder.rb in jekyll-maps-2.0.1
- old
+ new
@@ -70,13 +70,20 @@
@documents.map do |document|
{
:latitude => document["location"]["latitude"],
:longitude => document["location"]["longitude"],
:title => document["title"],
- :url => document["url"] || document.url,
+ :url => fetch_url(document),
:image => document["image"] || ""
}
end
+ end
+
+ private
+ def fetch_url(document)
+ return document["url"] if document.is_a?(Hash) && document.key?("url")
+ return document.url if document.respond_to? :url
+ return ""
end
end
end
end