Sha256: 85b222dd04039d16a2a6a713b3736a817d96eb19e0947a9b38f49616bbd8f3a7

Contents?: true

Size: 551 Bytes

Versions: 21

Compression:

Stored size: 551 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2018-2023, by Samuel Williams.
# Copyright, 2020, by Bruno Sutic.
# Copyright, 2023, by Thomas Morgan.

require 'protocol/http/body/wrapper'

module Async
	module HTTP
		module Body
			class Delayed < ::Protocol::HTTP::Body::Wrapper
				def initialize(body, delay = 0.01)
					super(body)
					
					@delay = delay
				end
				
				def ready?
					false
				end
				
				def read
					Async::Task.current.sleep(@delay)
					
					return super
				end
			end
		end
	end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
async-http-0.75.0 lib/async/http/body/delayed.rb
async-http-0.74.0 lib/async/http/body/delayed.rb
async-http-0.73.0 lib/async/http/body/delayed.rb
async-http-0.72.0 lib/async/http/body/delayed.rb
async-http-0.71.0 lib/async/http/body/delayed.rb
async-http-0.70.0 lib/async/http/body/delayed.rb
async-http-0.69.0 lib/async/http/body/delayed.rb
async-http-0.68.0 lib/async/http/body/delayed.rb
async-http-0.67.1 lib/async/http/body/delayed.rb
async-http-0.67.0 lib/async/http/body/delayed.rb
async-http-0.66.2 lib/async/http/body/delayed.rb
async-http-0.66.1 lib/async/http/body/delayed.rb
async-http-0.66.0 lib/async/http/body/delayed.rb
async-http-0.65.1 lib/async/http/body/delayed.rb
async-http-0.65.0 lib/async/http/body/delayed.rb
async-http-0.64.2 lib/async/http/body/delayed.rb
async-http-0.64.1 lib/async/http/body/delayed.rb
async-http-0.64.0 lib/async/http/body/delayed.rb
async-http-0.63.0 lib/async/http/body/delayed.rb
async-http-0.62.0 lib/async/http/body/delayed.rb