Class: Jekyll::Maps::LocationFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-maps/location_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ LocationFinder

Returns a new instance of LocationFinder.



4
5
6
7
# File 'lib/jekyll-maps/location_finder.rb', line 4

def initialize(options)
  @documents = []
  @options = options
end

Instance Method Details

#find(site, page) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jekyll-maps/location_finder.rb', line 9

def find(site, page)
  if @options[:attributes][:latitude] && @options[:attributes][:longitude]
    return [location_from_options(page)]
  elsif @options[:filters].empty?
    @documents << page if with_location?(page)
  else
    site.collections.each_value { |collection| filter(collection.docs) }
    site_data(site).each_value { |items| traverse(items) }
  end

  documents_to_locations
end