Class: Hakuban::TagObserveContract
- Inherits:
-
ObserveContract
- Object
- FFIObject
- Contract
- ObserveContract
- Hakuban::TagObserveContract
- Includes:
- Stream
- Defined in:
- lib/hakuban/contract.rb
Instance Attribute Summary
Attributes inherited from Contract
Instance Method Summary collapse
-
#initialize(exchange, descriptor, &block) ⇒ TagObserveContract
constructor
A new instance of TagObserveContract.
- #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) ⇒ TagObserveContract
Returns a new instance of TagObserveContract.
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/hakuban/contract.rb', line 89 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_tag_observe_contract_new(exchange_pointer, descriptor_pointer),:hakuban_tag_observe_contract_drop,nil) } } do_and_drop_or_return(&block) } end |
Instance Method Details
#next(&block) ⇒ Object
106 107 108 109 110 111 112 |
# File 'lib/hakuban/contract.rb', line 106 def next(&block) process_item( lambda { |pointer| FFI::hakuban_tag_observe_contract_next(pointer) }, lambda { |pointer| FFIObject::from_ffi_pointer(ObjectStateStream, pointer) }, &block ) end |