Module: Fias

Defined in:
lib/fias.rb,
lib/fias/query.rb,
lib/fias/config.rb,
lib/fias/railtie.rb,
lib/fias/version.rb,
lib/fias/import/dbf.rb,
lib/fias/name/split.rb,
lib/fias/import/copy.rb,
lib/fias/name/append.rb,
lib/fias/name/extract.rb,
lib/fias/query/finder.rb,
lib/fias/query/params.rb,
lib/fias/import/tables.rb,
lib/fias/name/synonyms.rb,
lib/fias/name/canonical.rb,
lib/fias/query/estimate.rb,
lib/fias/name/house_number.rb,
lib/fias/import/download_service.rb,
lib/fias/import/restore_parent_id.rb

Defined Under Namespace

Modules: Import, Name, Query Classes: Config, Railtie

Constant Summary collapse

LETTERS =
/[а-яА-ЯёЁA-Za-z]/ui
ANNIVESARIES =
/(\d+)(\s\-|\-|\s)лет(ия)?/ui
INITIAL =
/#{Fias::LETTERS}{1,2}\./ui
INITIALS =
/(#{INITIAL}#{INITIAL}(#{INITIAL})?)(.+|$)/ui
SINGLE_INITIAL =
/(\.|\s|^)(#{Fias::LETTERS}{1,3}\.)(.+|$)/ui
FEDERAL_CITIES =
['Москва', 'Санкт-Петербург', 'Севастополь', 'Байконур']
VERSION =
'1.0.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/fias.rb', line 3

def config
  @config
end

Class Method Details

.configure(&block) ⇒ Object



5
6
7
# File 'lib/fias.rb', line 5

def configure(&block)
  @config = Config.new(&block)
end

.indivisible_wordsObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/fias.rb', line 9

def indivisible_words
  @indivisible_words ||=
    config
    .synonyms
    .flatten
    .find_all { |w| w.include?(' ') }
    .sort_by(&:size)
    .reverse
    .freeze
end

.wordObject



20
21
22
23
# File 'lib/fias.rb', line 20

def word
  @word ||=
    /(#{ANNIVESARIES}|#{indivisible_words.join('|')}|[#{LETTERS}\"\'\d\.\)\(\/\-]+)(\s|\,|$)/ui
end