Class: Innards::Parsers::SearchParser

Inherits:
ParserBase
  • Object
show all
Defined in:
lib/innards/parsers/search_parser.rb

Overview

SAX Parser for RETS Search Response

Instance Attribute Summary collapse

Attributes inherited from ParserBase

#metadata, #rets_response

Instance Method Summary collapse

Methods inherited from ParserBase

#data_merger, #data_splitter, #element_tracker_switch, #response_code, #split_multiline_key_value_pairs, #switch_active?, #valid_rets_response_received?

Constructor Details

#initializeSearchParser

Returns a new instance of SearchParser.



10
11
12
13
# File 'lib/innards/parsers/search_parser.rb', line 10

def initialize
  super
  @results = []
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



8
9
10
# File 'lib/innards/parsers/search_parser.rb', line 8

def columns
  @columns
end

#resultsObject (readonly)

Returns the value of attribute results.



8
9
10
# File 'lib/innards/parsers/search_parser.rb', line 8

def results
  @results
end

Instance Method Details

#attr(name, value) ⇒ Object



23
24
25
# File 'lib/innards/parsers/search_parser.rb', line 23

def attr(name, value)
  super
end

#end_element(name) ⇒ Object



19
20
21
# File 'lib/innards/parsers/search_parser.rb', line 19

def end_element(name)
  super
end

#start_element(name) ⇒ Object



15
16
17
# File 'lib/innards/parsers/search_parser.rb', line 15

def start_element(name)
  super
end

#text(value) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/innards/parsers/search_parser.rb', line 27

def text(value)
  super

  if switch_active?(:COLUMNS)
    @columns = data_splitter(value)
  end

  if switch_active?(:DATA)
    @results.push data_merger(@columns, data_splitter(value))
  end
end