Class: Libuv::Prepare
- Inherits:
-
Handle
- Object
- Q::Promise
- Q::DeferredPromise
- Handle
- Libuv::Prepare
- Defined in:
- lib/libuv/prepare.rb
Constant Summary
Constants included from Assertions
Constants inherited from Q::Promise
Instance Attribute Summary
Attributes inherited from Handle
Attributes inherited from Q::Promise
Instance Method Summary collapse
-
#initialize(reactor, callback = nil, &blk) ⇒ Prepare
constructor
A new instance of Prepare.
-
#progress(callback = nil, &blk) ⇒ Object
Used to update the callback that will be triggered on reactor prepare.
-
#start ⇒ Object
Enables the prepare handler.
-
#stop ⇒ Object
Disables the prepare handler.
Methods inherited from Handle
#active?, #close, #closed?, #closing?, #ref, #unref
Methods included from Assertions
#assert_block, #assert_boolean, #assert_type
Methods included from Resource
#check_result, #check_result!, #resolve, #to_ptr
Methods inherited from Q::DeferredPromise
Methods inherited from Q::Promise
#catch, #finally, #ruby_catch, #value
Constructor Details
#initialize(reactor, callback = nil, &blk) ⇒ Prepare
Returns a new instance of Prepare.
12 13 14 15 16 17 18 19 20 |
# File 'lib/libuv/prepare.rb', line 12 def initialize(reactor, callback = nil, &blk) @reactor = reactor @callback = callback || blk prepare_ptr = ::Libuv::Ext.allocate_handle_prepare error = check_result(::Libuv::Ext.prepare_init(reactor.handle, prepare_ptr)) super(prepare_ptr, error) end |
Instance Method Details
#progress(callback = nil, &blk) ⇒ Object
Used to update the callback that will be triggered on reactor prepare
41 42 43 44 |
# File 'lib/libuv/prepare.rb', line 41 def progress(callback = nil, &blk) @callback = callback || blk self end |