Class: HTTPX::Selector

Inherits:
Object
  • Object
show all
Defined in:
lib/httpx/selector.rb

Instance Method Summary collapse

Constructor Details

#initializeSelector

Returns a new instance of Selector.



33
34
35
# File 'lib/httpx/selector.rb', line 33

def initialize
  @selectables = []
end

Instance Method Details

#deregister(io) ⇒ Object

deregisters io from selectables.



38
39
40
# File 'lib/httpx/selector.rb', line 38

def deregister(io)
  @selectables.delete(io)
end

#register(io) ⇒ Object

register io.



43
44
45
46
47
# File 'lib/httpx/selector.rb', line 43

def register(io)
  return if @selectables.include?(io)

  @selectables << io
end

#select(interval, &block) ⇒ Object



129
130
131
132
133
# File 'lib/httpx/selector.rb', line 129

def select(interval, &block)
  return select_one(interval, &block) if @selectables.size == 1

  select_many(interval, &block)
end