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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ad5fd97ba62e73095004bd9e6759ea6e4ae17db
4
- data.tar.gz: 5d7d62bc468d7a4bd643a163f1b9d5374bb0d939
3
+ metadata.gz: 80457df81ef37f61db2c2afca6bd67ee8e527763
4
+ data.tar.gz: b4a787833ce6f2103d5ca367ae1e2674e58b0d0d
5
5
  SHA512:
6
- metadata.gz: 973fcd4be6110e1ffaf61e47a21fbb627416801c6e405cd21a55da7685252c87658086c143ba61931500170377d8de55b9934aa1e39d83f9de1d600de3155563
7
- data.tar.gz: fc60dc7bdd39bc83dab2eff2305afc85b12455660231e03e4ada00dc6e9cf2a1880cc7be7c8c7ee66a417167d4f68f5640cb3f5ebcd29376998960254471f02a
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]
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Fias
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -4,6 +4,11 @@
4
4
  - Чувашия
5
5
  - Чувашская Республика - Чувашия
6
6
 
7
+ -
8
+ - [Чувашская Республика -, Чувашия]
9
+ - Чувашская Респ.
10
+ - Чувашская Республика
11
+
7
12
  -
8
13
  - [Ханты-Мансийский Автономный округ - Югра, АО]
9
14
  - Ханты-Мансийский Автономный округ - Югра
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.1
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: 2015-05-18 00:00:00.000000000 Z
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.6
336
+ rubygems_version: 2.4.8
337
337
  signing_key:
338
338
  specification_version: 4
339
339
  summary: Imports Russian FIAS database into SQL