geomash 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f51ecd1752538ca69b4f80d4069519842e9f78c4
4
- data.tar.gz: f3f8a263990c5441b76532fc3d39f282b25c91c5
3
+ metadata.gz: 5b352aa88b7f74448b67dc9aa8bc1e0886483b48
4
+ data.tar.gz: 6b217b344779f407b08906f1bb250fcd35f086db
5
5
  SHA512:
6
- metadata.gz: f98af5d1b09972e6b16cc5b5beb0360cf965c2eb58494aaa075c565672ee294e909799bf22c46c0cfa24580e0838b75fae973c4c9845f655992e77e2e60e5969
7
- data.tar.gz: 439939cef31ad2058efeb8546de0f20fbdfc2457484d23dda80c150ca42a7d8e36b835e61e917e54ce3276d44114dc345b1fcd396952a46f5eb2b6eb333fc4d6
6
+ metadata.gz: 58b2714da28ec388c7b07e82ea2c51c40b1b2d9fbded27f54bd8f0521cc6561cd3e5115cbc4b370275a51692a18020c9a5a7f78fce04c796e69d3899d5b1513c
7
+ data.tar.gz: 881c889566bce33fdcba5109b9efef976f75409c9349ccdef41bc6fc09b0551d2bb6f33d8aa9bb7dd100a6789e95fdc90ab944e31a6d3cf7e2c7ad16c0ec6bdd
@@ -116,7 +116,13 @@ module Geomash
116
116
  end
117
117
  end
118
118
 
119
- geo_term = geo_term.squeeze(',')
119
+ temp_term = []
120
+ geo_term.split(',').each do |split_term|
121
+ temp_term << split_term.strip if split_term.present?
122
+ end
123
+ geo_term = temp_term.join(', ')
124
+
125
+ geo_term = geo_term.squeeze(',') #This may no longer bee needed wih th the above
120
126
 
121
127
  return geo_term
122
128
  end
@@ -188,7 +194,8 @@ module Geomash
188
194
 
189
195
  #Keep original string if three parts at least or if there is a number in the term.
190
196
  #TODO: Make this better!
191
- if (term.split(',').length >= 3 && geo_hash[:neighborhood_part].blank?) || (term.split(',').length >= 2 && geo_hash[:city_part].blank?) || term.split(',').length >= 4 || term.match(/\d/).present?
197
+ #Note: Counties can cause this first length check to fail. For now, adding a check for county word but temporary solution...
198
+ if (term.split(',').length >= 4 && geo_hash[:neighborhood_part].blank?) || (term.split(',').length >= 3 && geo_hash[:neighborhood_part].blank? && !geo_hash[:original_term].match(/[Cc]ounty/)) || (term.split(',').length >= 2 && geo_hash[:city_part].blank?) || term.split(',').length >= 4 || term.match(/\d/).present?
192
199
  return true
193
200
  end
194
201
 
@@ -1,3 +1,3 @@
1
1
  module Geomash
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
data/test/geomash_test.rb CHANGED
@@ -17,9 +17,9 @@ class GeomashTest < ActiveSupport::TestCase
17
17
  assert_equal nil, result[:neighborhood_part]
18
18
  assert_equal nil, result[:street_part]
19
19
  assert_equal '2049596', result[:tgn][:id] if Geomash::TGN.tgn_enabled == true
20
- assert_equal true, result[:tgn][:original_string_differs] if Geomash::TGN.tgn_enabled == true #This should be false?
20
+ assert_equal false, result[:tgn][:original_string_differs] if Geomash::TGN.tgn_enabled == true
21
21
  assert_equal '4933002', result[:geonames][:id] if Geomash::Geonames.geonames_username != '<username>'
22
- assert_equal true, result[:geonames][:original_string_differs] if Geomash::Geonames.geonames_username != '<username>' #This should be false?
22
+ assert_equal false, result[:geonames][:original_string_differs] if Geomash::Geonames.geonames_username != '<username>'
23
23
 
24
24
  #Slight variation problem with neighborhood: 11. Bezirk (Vienna, Austria)--Biography
25
25
  result = Geomash.parse('15. Bezirk (Rudolfsheim-Fünfhaus, Vienna, Austria)--Exhibitions', true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geomash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boston Public Library