Class: BulkOperations::OrderedBulkProxy
- Defined in:
- lib/bulk_operations/ordered_bulk.rb
Instance Attribute Summary
Attributes inherited from BulkProxy
Instance Method Summary collapse
Methods inherited from BulkProxy
#execute, #initialize, #method_missing
Constructor Details
This class inherits a constructor from BulkOperations::BulkProxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BulkOperations::BulkProxy
Instance Method Details
#create_fiber(name, args, block, result) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bulk_operations/ordered_bulk.rb', line 17 def create_fiber(name, args, block, result) fiber = Fiber.new do begin call_result = @proxied_object.__send__(name, *args, &block) result[name] = { ok: true, result: call_result } rescue => exception result[name] = { ok: false, result: exception } end end fiber end |
#do_execute ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/bulk_operations/ordered_bulk.rb', line 3 def do_execute result = Hash.new fibers = [] @operation_stack.each do |operation| name, *args, block = *operation fibers << create_fiber(name, args, block, result) end fibers.each(&:resume) StructResult.new result end |