Class: HTTPClient::Chunk

Inherits:
Object show all
Defined in:
lib/rwd/net.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Chunk

Returns a new instance of Chunk.



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/rwd/net.rb', line 292

def initialize(data)
  @data	= ""
  line, data	= data.split(/\r*\n/, 2)
  size, ext		= line.split(/;/, 2)
  size		= size.hex
  while not size.zero? and not data.nil?
    @data		+= data[0..(size-1)]
    data		= data[size..-1]
    if not data.nil?
      data.gsub!(/^\r*\n/, "")
      line, data	= data.split(/\r*\n/, 2)
      size, ext	= line.split(/;/, 2)
      size		= size.hex
    end
  end
end

Instance Method Details

#to_sObject



309
310
311
# File 'lib/rwd/net.rb', line 309

def to_s
  @data
end