Class: Async::HTTP::Body::Delayed

Inherits:
Wrapper show all
Defined in:
lib/async/http/body/delayed.rb

Instance Attribute Summary

Attributes inherited from Wrapper

#body

Instance Method Summary collapse

Methods inherited from Wrapper

#close, #empty?, #finish, #inspect, #length

Methods inherited from Readable

#close, #each, #empty?, #finish, #join, #length

Constructor Details

#initialize(body, delay = 0.01) ⇒ Delayed

Returns a new instance of Delayed.



27
28
29
30
31
# File 'lib/async/http/body/delayed.rb', line 27

def initialize(body, delay = 0.01)
	super(body)
	
	@delay = delay
end

Instance Method Details

#readObject



33
34
35
36
37
# File 'lib/async/http/body/delayed.rb', line 33

def read
	Async::Task.current.sleep(@delay)
	
	return super
end