Class: Fog::XML::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/xml/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(parser) ⇒ Response

Returns a new instance of Response.



4
5
6
7
8
# File 'lib/fog/xml/response.rb', line 4

def initialize(parser)
  @parser = parser
  @data_stream = Nokogiri::XML::SAX::PushParser.new(parser)
  @response_string = ""
end

Instance Method Details

#call(chunk, _remaining, _total) ⇒ Object



10
11
12
13
# File 'lib/fog/xml/response.rb', line 10

def call(chunk, _remaining, _total)
  @response_string << chunk if ENV["DEBUG_RESPONSE"]
  @data_stream << chunk
end

#finishObject



20
21
22
23
# File 'lib/fog/xml/response.rb', line 20

def finish
  Fog::Logger.debug "\n#{@response_string}" if ENV["DEBUG_RESPONSE"]
  @data_stream.finish
end

#rewindObject



15
16
17
18
# File 'lib/fog/xml/response.rb', line 15

def rewind
  @parser.reset
  @response_string = ""
end