Class: FiasReader::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/fias_reader/reader.rb,
lib/fias_reader/reader/row.rb

Overview

Инерфейс для работы XML с базой ФИАС

Defined Under Namespace

Classes: Row

Constant Summary collapse

XML_DATE_SEPARATOR =

Итерируем по всем активным записям домов, принимает блок в качестве аргумента В вызываемы блок передается объект типа FiasReader::Reader::Row.

'-'.freeze
EMPTY_STRING =
'0'.freeze
TODAY =
Date.today.strftime('%Y0%m0%d').to_i

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Reader

Returns a new instance of Reader.



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

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/fias_reader/reader.rb', line 4

def path
  @path
end

Instance Method Details

#eachObject



14
15
16
17
18
19
20
21
22
# File 'lib/fias_reader/reader.rb', line 14

def each
  Cache.init self

  Table::House.new(self).query.all do |row|
    next unless active?(row)
    row = FiasReader::Reader::Row.new row
    yield row if row.address_object
  end
end