class HTTPX::Selector

  1. lib/httpx/selector.rb
Superclass: Object

Methods

Public Class

  1. new

Public Instance

  1. deregister
  2. register
  3. select

Public Class methods

new()
[show source]
   # File lib/httpx/selector.rb
12 def initialize
13   @selectables = []
14 end

Public Instance methods

deregister(io)

deregisters io from selectables.

[show source]
   # File lib/httpx/selector.rb
17 def deregister(io)
18   @selectables.delete(io)
19 end
register(io)

register io.

[show source]
   # File lib/httpx/selector.rb
22 def register(io)
23   return if @selectables.include?(io)
24 
25   @selectables << io
26 end
select(interval, &block)
[show source]
    # File lib/httpx/selector.rb
124 def select(interval, &block)
125   # do not cause an infinite loop here.
126   #
127   # this may happen if timeout calculation actually triggered an error which causes
128   # the connections to be reaped (such as the total timeout error) before #select
129   # gets called.
130   return if interval.nil? && @selectables.empty?
131 
132   return select_one(interval, &block) if @selectables.size == 1
133 
134   select_many(interval, &block)
135 end