Module: FiasReader::ParseLogic::Rows

Includes:
Abstract
Defined in:
lib/fias_reader/parse_logic/rows.rb

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/fias_reader/parse_logic/rows.rb', line 19

def end_element(name)
  if @rows_enabled && @depth == 1
    @options[:rows].call(@row) if @row
    @row = nil
  end
  super
end

#initialize(options) ⇒ Object



6
7
8
9
# File 'lib/fias_reader/parse_logic/rows.rb', line 6

def initialize(options)
  @rows_enabled = true if @options[:rows].respond_to? :call
  super
end

#start_element(name) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/fias_reader/parse_logic/rows.rb', line 11

def start_element(name)
  if @rows_enabled && @depth == 2
    @row = {}
    @skip = false
  end
  super
end