Class: RETS4R::Client::CompactNokogiriParser::CompactDocument

Inherits:
Nokogiri::XML::SAX::Document
  • Object
show all
Defined in:
lib/rets4r/client/parsers/compact_nokogiri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCompactDocument

Returns a new instance of CompactDocument.



27
28
29
# File 'lib/rets4r/client/parsers/compact_nokogiri.rb', line 27

def initialize
  @results = []
end

Instance Attribute Details

#proc=(value) ⇒ Object (writeonly)

Sets the attribute proc

Parameters:

  • value

    the value to set the attribute proc to.



25
26
27
# File 'lib/rets4r/client/parsers/compact_nokogiri.rb', line 25

def proc=(value)
  @proc = value
end

#resultsObject (readonly)

Returns the value of attribute results.



24
25
26
# File 'lib/rets4r/client/parsers/compact_nokogiri.rb', line 24

def results
  @results
end

Instance Method Details

#characters(string) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/rets4r/client/parsers/compact_nokogiri.rb', line 56

def characters string
  if @columns_element
    @string << string
  elsif @data_element
    @string << string
  elsif @reply_code
    throw string
    @reply_code = false
  end
end

#end_element(name) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/rets4r/client/parsers/compact_nokogiri.rb', line 45

def end_element name
  case name
  when 'COLUMNS'
    @columns_element = false
    @columns = @string.split(@delimiter)
  when 'DATA'
    @data_element = false
    handle_row
  end
end

#start_element(name, attrs = []) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rets4r/client/parsers/compact_nokogiri.rb', line 30

def start_element name, attrs = []
  case name
  when 'DELIMITER'
    @delimiter = attrs.last.to_i.chr
  when 'COLUMNS'
    @columns_element = true
    @string = ''
  when 'DATA'
    @data_element = true
    @string = ''
  when 'RETS'
    handle_body_start attrs
  end
end