Class: FiasReader::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/fias_reader/table.rb,
lib/fias_reader/table/house.rb,
lib/fias_reader/table/address_part.rb

Overview

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

Direct Known Subclasses

AddressPart, House

Defined Under Namespace

Classes: AddressPart, House

Constant Summary collapse

LOGICS =
[
  ParseLogic::Depth,
  ParseLogic::Rows,
  ParseLogic::Attributes
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(reader) ⇒ Table

Returns a new instance of Table.



9
10
11
# File 'lib/fias_reader/table.rb', line 9

def initialize(reader)
  @reader = reader
end

Instance Method Details

#fileObject



17
18
19
# File 'lib/fias_reader/table.rb', line 17

def file
  File.new(file_path, 'r')
end

#file_pathObject



21
22
23
24
25
26
# File 'lib/fias_reader/table.rb', line 21

def file_path
  Dir[
    "#{@reader.path}/#{self.class::File}_*.XML",
    "#{@reader.path}/#{self.class::File}_*.xml"
  ].first
end

#queryObject



13
14
15
# File 'lib/fias_reader/table.rb', line 13

def query
  FiasReader::Scope.new(self)
end