Class: Nitrous::HttpIO
- Inherits:
-
Object
- Object
- Nitrous::HttpIO
- Defined in:
- lib/nitrous/http_io.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ HttpIO
constructor
A new instance of HttpIO.
- #is_a?(klass) ⇒ Boolean
- #read(len = nil) ⇒ Object
- #size ⇒ Object
- #write(string) ⇒ Object
Constructor Details
#initialize ⇒ HttpIO
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
#close ⇒ Object
30 31 32 |
# File 'lib/nitrous/http_io.rb', line 30 def close @closed = true end |
#is_a?(klass) ⇒ 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 |
#size ⇒ Object
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 |