lib/jekyll-maps/location_finder.rb in jekyll-maps-1.1.4 vs lib/jekyll-maps/location_finder.rb in jekyll-maps-1.1.5
- old
+ new
@@ -12,19 +12,11 @@
else
site.collections.each { |_, collection| filter(collection.docs) }
site.data.each { |_, docs| filter(docs) }
end
- @documents.map do |document|
- {
- :latitude => document["location"]["latitude"],
- :longitude => document["location"]["longitude"],
- :title => document["title"],
- :url => document["url"] || document.url,
- :image => document["image"] || ""
- }
- end
+ convert
end
private
def filter(docs)
docs.each do |doc|
@@ -39,9 +31,22 @@
private
def match_filters?(doc)
@options[:filters].each do |key, value|
return false if doc[key].nil? || doc[key] != value
+ end
+ end
+
+ private
+ def convert
+ @documents.map do |document|
+ {
+ :latitude => document["location"]["latitude"],
+ :longitude => document["location"]["longitude"],
+ :title => document["title"],
+ :url => document["url"] || document.url,
+ :image => document["image"] || ""
+ }
end
end
end
end
end