Class: GeoSpider::Extractors::Microformat

Inherits:
Base
  • Object
show all
Defined in:
lib/geo-spider/extractors/microformat.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GeoSpider::Extractors::Base

Instance Method Details

#locationsObject



9
10
11
12
13
14
15
# File 'lib/geo-spider/extractors/microformat.rb', line 9

def locations
  @element.search("abbr[@class='geo'][@title]").map do |geo|
    latitude, longitude = geo.attributes["title"].split(";")
    text = geo.inner_text
    Location.new(:latitude => latitude.to_f, :longitude => longitude.to_f, :title => text)
  end
end