Class: Async::HTTP::Body::Remainder

Inherits:
Readable
  • Object
show all
Defined in:
lib/async/http/body/fixed.rb

Instance Method Summary collapse

Methods inherited from Readable

#close, #each, #length

Constructor Details

#initialize(stream) ⇒ Remainder



70
71
72
# File 'lib/async/http/body/fixed.rb', line 70

def initialize(stream)
  @stream = stream
end

Instance Method Details

#empty?Boolean



74
75
76
# File 'lib/async/http/body/fixed.rb', line 74

def empty?
  @stream.closed?
end

#inspectObject



91
92
93
# File 'lib/async/http/body/fixed.rb', line 91

def inspect
  "\#<#{self.class} #{@stream.closed? ? 'closed' : 'open'}>"
end

#joinObject



87
88
89
# File 'lib/async/http/body/fixed.rb', line 87

def join
  read
end

#readObject



83
84
85
# File 'lib/async/http/body/fixed.rb', line 83

def read
  @stream.read_partial
end

#stop(error) ⇒ Object



78
79
80
81
# File 'lib/async/http/body/fixed.rb', line 78

def stop(error)
  # We can't really do anything in this case except close the connection.
  @stream.close
end