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

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

Instance Method Summary collapse

Methods inherited from Readable

#each, #finish, #length

Constructor Details

#initialize(stream) ⇒ Remainder

Returns a new instance of Remainder.



27
28
29
# File 'lib/async/http/body/remainder.rb', line 27

def initialize(stream)
  @stream = stream
end

Instance Method Details

#close(error = nil) ⇒ Object



35
36
37
38
39
40
# File 'lib/async/http/body/remainder.rb', line 35

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

#empty?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/async/http/body/remainder.rb', line 31

def empty?
  @stream.closed?
end

#inspectObject



50
51
52
# File 'lib/async/http/body/remainder.rb', line 50

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

#joinObject



46
47
48
# File 'lib/async/http/body/remainder.rb', line 46

def join
  read
end

#readObject



42
43
44
# File 'lib/async/http/body/remainder.rb', line 42

def read
  @stream.read_partial
end