geo-spider 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,12 +11,20 @@ module GeoSpider
11
11
  REGEXP = /(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])(\s*)[0-9][ABD-HJLNP-UW-Z]{2})/i
12
12
 
13
13
  def locations
14
- results = @element.inner_text.scan(REGEXP)
14
+ results = @element.inner_html.scan(REGEXP)
15
15
  results = results.map(&:first)
16
16
 
17
- results.map do |result|
18
- latitude, longitude = geocoder.location(result)
19
- Location.new(:latitude => latitude, :longitude => longitude, :title => result)
17
+ locations = []
18
+
19
+ results.each do |result|
20
+ begin
21
+ p = geocoder.locate(result)
22
+ locations << Location.new(:latitude => p.latitude, :longitude => p.longitude, :title => result)
23
+ rescue Graticule::Error
24
+ next
25
+ end
26
+
27
+ return locations
20
28
  end
21
29
  end
22
30
 
@@ -28,7 +28,7 @@ module GeoSpider
28
28
  seen << url
29
29
  next_links = (page.internal_links - seen - queue) # only add internal links that we've not seen or already have queued.
30
30
  queue.concat(next_links)
31
- rescue # need to decide what exactly to rescue from, rather than just everything.
31
+ rescue Timeout::Error => e
32
32
  next
33
33
  end
34
34
  end
@@ -2,7 +2,7 @@ module GeoSpider
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo-spider
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Taylor
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-29 00:00:00 +01:00
12
+ date: 2008-10-01 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency