Module: HTTPX::Plugins::StreamBidi::ConnectionMethods

Defined in:
lib/httpx/plugins/stream_bidi.rb,
sig/plugins/stream_bidi.rbs

Overview

overrides the declaration of @write_buffer, which is now a thread-safe buffer responding to the same API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#signal=(value) ⇒ Object (writeonly)

Sets the attribute signal

Parameters:

  • value

    the value to set the attribute signal to.



371
372
373
# File 'lib/httpx/plugins/stream_bidi.rb', line 371

def signal=(value)
  @signal = value
end

Instance Method Details

#callObject



390
391
392
393
394
# File 'lib/httpx/plugins/stream_bidi.rb', line 390

def call
  return super unless @options.stream && (error = @signal.error)

  on_error(error)
end

#initializeObject



373
374
375
376
377
378
379
# File 'lib/httpx/plugins/stream_bidi.rb', line 373

def initialize(*)
  super

  return unless @options.stream

  @write_buffer = BidiBuffer.new(@options.buffer_size)
end

#interestsObject

rebuffers the @write_buffer before calculating interests.



382
383
384
385
386
387
388
# File 'lib/httpx/plugins/stream_bidi.rb', line 382

def interests
  return super unless @options.stream

  @write_buffer.rebuffer

  super
end