Sha256: b1f29a9df39829309c27dc796c4401be2fdd9e8f780861f8528ab764bc6d474e
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module Jekyll module Maps class LocationFinder def initialize(options) @options = options end def find(site) matching_documents(site).map do |document| { :latitude => document["location"]["latitude"], :longitude => document["location"]["longitude"], :title => document["title"], :url => document.url } end end private def matching_documents(site) documents = [] site.collections.each do |_, collection| collection.docs.each do |doc| documents << doc if location?(doc) && match_filters?(doc) end end documents end private def location?(doc) !doc["location"].nil? && !doc["location"].empty? end private def match_filters?(doc) @options[:filters].each do |key, value| return false if doc[key].nil? || doc[key] != value end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-maps-1.0.2 | lib/jekyll-maps/location_finder.rb |