fias 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fias.rb +5 -0
- data/lib/fias/config.rb +6 -1
- data/lib/fias/name/append.rb +3 -0
- data/lib/fias/version.rb +1 -1
- data/spec/fixtures/status_append.yml +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80457df81ef37f61db2c2afca6bd67ee8e527763
|
4
|
+
data.tar.gz: b4a787833ce6f2103d5ca367ae1e2674e58b0d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8166cf054ba4517b8101b4f8fd862634bac67cee088225d2eb4ad6168aa993ed616586a9de264f15cc8712b6e316a0c341efb670cdaae11992a7fffff123140b
|
7
|
+
data.tar.gz: 3f2730b8b643c2caac1b853fb745e9a8b9fcc338fb127cce07533667c3a513b5d0dc9ec4a74a700884fbc6bf4f7a538dab8064a8ff80a51a3e7f1972e5c1e656
|
data/lib/fias.rb
CHANGED
@@ -181,11 +181,16 @@ Fias.configure do |config|
|
|
181
181
|
config.add_exception(
|
182
182
|
'Чувашская Республика - Чувашия', 'Чувашия'
|
183
183
|
)
|
184
|
+
|
184
185
|
config.add_exception(
|
185
186
|
'Ханты-Мансийский Автономный округ - Югра',
|
186
187
|
'Ханты-Мансийский Автономный округ - Югра'
|
187
188
|
)
|
188
189
|
|
190
|
+
config.add_replacement(
|
191
|
+
'Чувашская Республика -', ['Чувашская Респ.', 'Чувашская Республика']
|
192
|
+
)
|
193
|
+
|
189
194
|
proper_names =
|
190
195
|
File.readlines(File.join(File.dirname(__FILE__), '../config/names.txt'))
|
191
196
|
|
data/lib/fias/config.rb
CHANGED
@@ -7,6 +7,7 @@ module Fias
|
|
7
7
|
@aliases = {}
|
8
8
|
@exceptions = {}
|
9
9
|
@proper_names = []
|
10
|
+
@replacements = {}
|
10
11
|
@synonyms = []
|
11
12
|
@synonyms_index = {}
|
12
13
|
|
@@ -15,7 +16,7 @@ module Fias
|
|
15
16
|
finalize_index
|
16
17
|
end
|
17
18
|
|
18
|
-
attr_reader :index, :longs, :shorts, :aliases, :exceptions
|
19
|
+
attr_reader :index, :longs, :shorts, :aliases, :exceptions, :replacements
|
19
20
|
attr_reader :proper_names, :synonyms, :synonyms_index
|
20
21
|
|
21
22
|
def add_name(long, short, aliases = [])
|
@@ -26,6 +27,10 @@ module Fias
|
|
26
27
|
populate_index(long, short, aliases)
|
27
28
|
end
|
28
29
|
|
30
|
+
def add_replacement(target, value)
|
31
|
+
@replacements[Unicode.downcase(target)] = value
|
32
|
+
end
|
33
|
+
|
29
34
|
def add_exception(long, short)
|
30
35
|
@exceptions[Unicode.downcase(short)] = [long, short]
|
31
36
|
@exceptions[Unicode.downcase(long)] = [long, short]
|
data/lib/fias/name/append.rb
CHANGED
@@ -8,6 +8,9 @@ module Fias
|
|
8
8
|
exception = Fias.config.exceptions[Unicode.downcase(name)]
|
9
9
|
return exception.reverse if exception
|
10
10
|
|
11
|
+
replacement = Fias.config.replacements[Unicode.downcase(name)]
|
12
|
+
return replacement if replacement
|
13
|
+
|
11
14
|
[concat(short, name), concat(long, name)]
|
12
15
|
end
|
13
16
|
|
data/lib/fias/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fias
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dbf
|
@@ -333,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
333
333
|
version: '0'
|
334
334
|
requirements: []
|
335
335
|
rubyforge_project:
|
336
|
-
rubygems_version: 2.4.
|
336
|
+
rubygems_version: 2.4.8
|
337
337
|
signing_key:
|
338
338
|
specification_version: 4
|
339
339
|
summary: Imports Russian FIAS database into SQL
|