geocoder 1.6.1 → 1.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/LICENSE +1 -1
  4. data/README.md +7 -28
  5. data/bin/console +13 -0
  6. data/lib/easting_northing.rb +171 -0
  7. data/lib/geocoder/cache.rb +4 -0
  8. data/lib/geocoder/configuration.rb +2 -1
  9. data/lib/geocoder/configuration_hash.rb +4 -4
  10. data/lib/geocoder/ip_address.rb +2 -1
  11. data/lib/geocoder/lookup.rb +2 -0
  12. data/lib/geocoder/lookups/ban_data_gouv_fr.rb +1 -1
  13. data/lib/geocoder/lookups/esri.rb +6 -0
  14. data/lib/geocoder/lookups/geocodio.rb +1 -1
  15. data/lib/geocoder/lookups/google.rb +7 -2
  16. data/lib/geocoder/lookups/google_places_details.rb +8 -14
  17. data/lib/geocoder/lookups/google_places_search.rb +28 -2
  18. data/lib/geocoder/lookups/google_premier.rb +4 -0
  19. data/lib/geocoder/lookups/latlon.rb +1 -2
  20. data/lib/geocoder/lookups/maxmind_local.rb +7 -1
  21. data/lib/geocoder/lookups/nationaal_georegister_nl.rb +38 -0
  22. data/lib/geocoder/lookups/smarty_streets.rb +6 -1
  23. data/lib/geocoder/lookups/telize.rb +1 -1
  24. data/lib/geocoder/lookups/test.rb +4 -0
  25. data/lib/geocoder/lookups/uk_ordnance_survey_names.rb +59 -0
  26. data/lib/geocoder/lookups/yandex.rb +1 -2
  27. data/lib/geocoder/results/ban_data_gouv_fr.rb +26 -1
  28. data/lib/geocoder/results/db_ip_com.rb +1 -1
  29. data/lib/geocoder/results/ipregistry.rb +4 -8
  30. data/lib/geocoder/results/nationaal_georegister_nl.rb +62 -0
  31. data/lib/geocoder/results/nominatim.rb +4 -0
  32. data/lib/geocoder/results/uk_ordnance_survey_names.rb +59 -0
  33. data/lib/geocoder/results/yandex.rb +217 -59
  34. data/lib/geocoder/util.rb +29 -0
  35. data/lib/geocoder/version.rb +1 -1
  36. metadata +13 -8
  37. data/lib/hash_recursive_merge.rb +0 -73
@@ -1,73 +0,0 @@
1
- #
2
- # = Hash Recursive Merge
3
- #
4
- # Merges a Ruby Hash recursively, Also known as deep merge.
5
- # Recursive version of Hash#merge and Hash#merge!.
6
- #
7
- # Category:: Ruby
8
- # Package:: Hash
9
- # Author:: Simone Carletti <weppos@weppos.net>
10
- # Copyright:: 2007-2008 The Authors
11
- # License:: MIT License
12
- # Link:: http://www.simonecarletti.com/
13
- # Source:: http://gist.github.com/gists/6391/
14
- #
15
- module HashRecursiveMerge
16
-
17
- #
18
- # Recursive version of Hash#merge!
19
- #
20
- # Adds the contents of +other_hash+ to +hsh+,
21
- # merging entries in +hsh+ with duplicate keys with those from +other_hash+.
22
- #
23
- # Compared with Hash#merge!, this method supports nested hashes.
24
- # When both +hsh+ and +other_hash+ contains an entry with the same key,
25
- # it merges and returns the values from both arrays.
26
- #
27
- # h1 = {"a" => 100, "b" => 200, "c" => {"c1" => 12, "c2" => 14}}
28
- # h2 = {"b" => 254, "c" => {"c1" => 16, "c3" => 94}}
29
- # h1.rmerge!(h2) #=> {"a" => 100, "b" => 254, "c" => {"c1" => 16, "c2" => 14, "c3" => 94}}
30
- #
31
- # Simply using Hash#merge! would return
32
- #
33
- # h1.merge!(h2) #=> {"a" => 100, "b" = >254, "c" => {"c1" => 16, "c3" => 94}}
34
- #
35
- def rmerge!(other_hash)
36
- merge!(other_hash) do |key, oldval, newval|
37
- oldval.class == self.class ? oldval.rmerge!(newval) : newval
38
- end
39
- end
40
-
41
- #
42
- # Recursive version of Hash#merge
43
- #
44
- # Compared with Hash#merge!, this method supports nested hashes.
45
- # When both +hsh+ and +other_hash+ contains an entry with the same key,
46
- # it merges and returns the values from both arrays.
47
- #
48
- # Compared with Hash#merge, this method provides a different approch
49
- # for merging nasted hashes.
50
- # If the value of a given key is an Hash and both +other_hash+ abd +hsh
51
- # includes the same key, the value is merged instead replaced with
52
- # +other_hash+ value.
53
- #
54
- # h1 = {"a" => 100, "b" => 200, "c" => {"c1" => 12, "c2" => 14}}
55
- # h2 = {"b" => 254, "c" => {"c1" => 16, "c3" => 94}}
56
- # h1.rmerge(h2) #=> {"a" => 100, "b" => 254, "c" => {"c1" => 16, "c2" => 14, "c3" => 94}}
57
- #
58
- # Simply using Hash#merge would return
59
- #
60
- # h1.merge(h2) #=> {"a" => 100, "b" = >254, "c" => {"c1" => 16, "c3" => 94}}
61
- #
62
- def rmerge(other_hash)
63
- merge(other_hash) do |key, oldval, newval|
64
- oldval.class == self.class ? oldval.rmerge(newval) : newval
65
- end
66
- end
67
-
68
- end
69
-
70
-
71
- class Hash
72
- include HashRecursiveMerge
73
- end