Class: Hakuban::ObjectObserveContract
- Inherits:
-
ObserveContract
- Object
- FFIObject
- Contract
- ObserveContract
- Hakuban::ObjectObserveContract
- Includes:
- Stream
- Defined in:
- lib/hakuban/contract.rb
Instance Attribute Summary
Attributes inherited from Contract
Instance Method Summary collapse
-
#initialize(exchange, descriptor, &block) ⇒ ObjectObserveContract
constructor
A new instance of ObjectObserveContract.
- #next(&block) ⇒ Object
Methods included from Stream
#each, #for_each, #for_each_concurrent, #for_each_in_thread, #for_each_till_next
Methods inherited from Contract
Methods inherited from FFIObject
#do_and_drop_or_return, #drop, #dropped?, from_ffi_pointer, generate_finalizer, #initialize_copy, #inspect, #with_pointer, with_pointers
Constructor Details
#initialize(exchange, descriptor, &block) ⇒ ObjectObserveContract
Returns a new instance of ObjectObserveContract.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hakuban/contract.rb', line 24 def initialize(exchange, descriptor, &block) super() @exchange, @descriptor = exchange, descriptor Thread.handle_interrupt(Object => :never) { @exchange.with_pointer { |exchange_pointer| @descriptor.with_pointer { |descriptor_pointer| initialize_pointer(FFI::hakuban_object_observe_contract_new(exchange_pointer, descriptor_pointer),:hakuban_object_observe_contract_drop,nil) } } do_and_drop_or_return(&block) } end |
Instance Method Details
#next(&block) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/hakuban/contract.rb', line 41 def next(&block) process_item( lambda { |pointer| FFI::hakuban_object_observe_contract_next(pointer) }, lambda { |pointer| FFIObject::from_ffi_pointer(ObjectStateStream, pointer) }, &block ) end |