Module: UV::Handle
- Includes:
- Assertions, Listener, Resource
- Defined in:
- lib/uv/handle.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #close(&block) ⇒ Object
- #closing? ⇒ Boolean
- #initialize(loop, pointer) ⇒ Object
-
#ref ⇒ Object
Public: Increment internal ref counter for the handle on the loop.
-
#unref ⇒ Object
Public: Decrement internal ref counter for the handle on the loop, useful to stop loop even when there are outstanding open handles.
Methods included from Assertions
#assert_arity, #assert_block, #assert_boolean, #assert_type
Methods included from Resource
#check_result, #check_result!, #to_ptr
Instance Method Details
#active? ⇒ Boolean
42 43 44 |
# File 'lib/uv/handle.rb', line 42 def active? UV.is_active(@pointer) > 0 end |
#close(&block) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/uv/handle.rb', line 29 def close(&block) if not block.nil? assert_block(block) assert_arity(0, block) @close_block = block end UV.close(@pointer, callback(:on_close)) self end |
#closing? ⇒ Boolean
46 47 48 |
# File 'lib/uv/handle.rb', line 46 def closing? UV.is_closing(@pointer) > 0 end |
#initialize(loop, pointer) ⇒ Object
5 6 7 |
# File 'lib/uv/handle.rb', line 5 def initialize(loop, pointer) @loop, @pointer = loop, pointer end |
#ref ⇒ Object
Public: Increment internal ref counter for the handle on the loop. Useful for extending the loop with custom watchers that need to make loop not stop
Returns self
13 14 15 16 17 |
# File 'lib/uv/handle.rb', line 13 def ref UV.ref(@pointer) self end |
#unref ⇒ Object
Public: Decrement internal ref counter for the handle on the loop, useful to stop loop even when there are outstanding open handles
Returns self
23 24 25 26 27 |
# File 'lib/uv/handle.rb', line 23 def unref UV.unref(@pointer) self end |