Class: EventMachine::HttpDecoders::GZip::LazyStringIO

Inherits:
Object
  • Object
show all
Defined in:
lib/em-http/decoders.rb

Instance Method Summary collapse

Constructor Details

#initialize(string = "") ⇒ LazyStringIO

Returns a new instance of LazyStringIO.



120
121
122
# File 'lib/em-http/decoders.rb', line 120

def initialize(string="")
  @stream = string
end

Instance Method Details

#<<(string) ⇒ Object



124
125
126
# File 'lib/em-http/decoders.rb', line 124

def <<(string)
  @stream << string
end

#read(length = nil, buffer = nil) ⇒ Object



128
129
130
131
132
133
134
# File 'lib/em-http/decoders.rb', line 128

def read(length=nil, buffer=nil)
  buffer ||= ""
  length ||= 0
  buffer << @stream[0..(length-1)]
  @stream = @stream[length..-1]
  buffer
end

#sizeObject



136
137
138
# File 'lib/em-http/decoders.rb', line 136

def size
  @stream.size
end