Class: Hakuban::ObjectExposeContract
- Inherits:
-
ExposeContract
- Object
- FFIObject
- Contract
- ExposeContract
- Hakuban::ObjectExposeContract
- Includes:
- Stream
- Defined in:
- lib/hakuban/contract.rb
Instance Attribute Summary
Attributes inherited from Contract
Instance Method Summary collapse
-
#initialize(exchange, descriptor, capacity, &block) ⇒ ObjectExposeContract
constructor
A new instance of ObjectExposeContract.
- #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, capacity, &block) ⇒ ObjectExposeContract
Returns a new instance of ObjectExposeContract.
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/hakuban/contract.rb', line 57 def initialize(exchange, descriptor, capacity, &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_expose_contract_new(exchange_pointer, descriptor_pointer, capacity),:hakuban_object_expose_contract_drop,nil) } } do_and_drop_or_return(&block) } end |
Instance Method Details
#next(&block) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/hakuban/contract.rb', line 74 def next(&block) process_item( lambda { |pointer| FFI::hakuban_object_expose_contract_next(pointer) }, lambda { |pointer| FFIObject::from_ffi_pointer(ObjectStateSink, pointer) }, &block ) end |