Class: IO::Event::Debug::Selector

Inherits:
Object
  • Object
show all
Defined in:
lib/io/event/debug/selector.rb

Overview

Enforces the selector interface and delegates operations to a wrapped selector instance.

Instance Method Summary collapse

Constructor Details

#initialize(selector) ⇒ Selector

Returns a new instance of Selector.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/io/event/debug/selector.rb', line 12

def initialize(selector)
	@selector = selector
	
	@readable = {}
	@writable = {}
	@priority = {}
	
	unless Fiber.current == selector.loop
		Kernel::raise "Selector must be initialized on event loop fiber!"
	end
end

Instance Method Details

#closeObject



28
29
30
31
32
33
34
35
# File 'lib/io/event/debug/selector.rb', line 28

def close
	if @selector.nil?
		Kernel::raise "Selector already closed!"
	end
	
	@selector.close
	@selector = nil
end

#io_readObject



70
71
72
# File 'lib/io/event/debug/selector.rb', line 70

def io_read(...)
	@selector.io_read(...)
end

#io_wait(fiber, io, events) ⇒ Object



66
67
68
# File 'lib/io/event/debug/selector.rb', line 66

def io_wait(fiber, io, events)
	@selector.io_wait(fiber, io, events)
end

#io_writeObject



74
75
76
# File 'lib/io/event/debug/selector.rb', line 74

def io_write(...)
	@selector.io_write(...)
end

#process_wait(*arguments) ⇒ Object



62
63
64
# File 'lib/io/event/debug/selector.rb', line 62

def process_wait(*arguments)
	@selector.process_wait(*arguments)
end

#push(fiber) ⇒ Object



50
51
52
# File 'lib/io/event/debug/selector.rb', line 50

def push(fiber)
	@selector.push(fiber)
end

#raise(fiber, *arguments) ⇒ Object



54
55
56
# File 'lib/io/event/debug/selector.rb', line 54

def raise(fiber, *arguments)
	@selector.raise(fiber, *arguments)
end

#ready?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/io/event/debug/selector.rb', line 58

def ready?
	@selector.ready?
end

#respond_to?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/io/event/debug/selector.rb', line 78

def respond_to?(name, include_private = false)
	@selector.respond_to?(name, include_private)
end

#resume(*arguments) ⇒ Object



42
43
44
# File 'lib/io/event/debug/selector.rb', line 42

def resume(*arguments)
	@selector.resume(*arguments)
end

#select(duration = nil) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/io/event/debug/selector.rb', line 82

def select(duration = nil)
	unless Fiber.current == @selector.loop
		Kernel::raise "Selector must be run on event loop fiber!"
	end
	
	@selector.select(duration)
end

#transferObject

Transfer from the calling fiber to the event loop.



38
39
40
# File 'lib/io/event/debug/selector.rb', line 38

def transfer
	@selector.transfer
end

#wakeupObject



24
25
26
# File 'lib/io/event/debug/selector.rb', line 24

def wakeup
	@selector.wakeup
end

#yieldObject



46
47
48
# File 'lib/io/event/debug/selector.rb', line 46

def yield
	@selector.yield
end