Class: Nitrous::HttpIO

Inherits:
Object
  • Object
show all
Defined in:
lib/nitrous/http_io.rb

Instance Method Summary collapse

Constructor Details

#initializeHttpIO

Returns a new instance of HttpIO.



6
7
8
# File 'lib/nitrous/http_io.rb', line 6

def initialize
  @string = String.new
end

Instance Method Details

#closeObject



30
31
32
# File 'lib/nitrous/http_io.rb', line 30

def close
  @closed = true
end

#is_a?(klass) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/nitrous/http_io.rb', line 10

def is_a?(klass)
  klass == IO ? true : super(klass);
end

#read(len = nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/nitrous/http_io.rb', line 18

def read(len=nil)
  sleep 1 while @string.empty? && !@closed
  return nil if @closed
  string = @string.dup
  @string = ""
  string
end

#sizeObject



14
15
16
# File 'lib/nitrous/http_io.rb', line 14

def size
  0
end

#write(string) ⇒ Object



26
27
28
# File 'lib/nitrous/http_io.rb', line 26

def write(string)
  @string << string
end