Class: TwoPercent::BulkProcessor
- Inherits:
-
Object
- Object
- TwoPercent::BulkProcessor
- Defined in:
- lib/two_percent/bulk_processor.rb
Instance Method Summary collapse
- #dispatch(event_handler = EventHandler) ⇒ Object
-
#initialize(operations) ⇒ BulkProcessor
constructor
A new instance of BulkProcessor.
Constructor Details
#initialize(operations) ⇒ BulkProcessor
Returns a new instance of BulkProcessor.
5 6 7 |
# File 'lib/two_percent/bulk_processor.rb', line 5 def initialize(operations) @operations = operations end |
Instance Method Details
#dispatch(event_handler = EventHandler) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/two_percent/bulk_processor.rb', line 9 def dispatch(event_handler = EventHandler) @operations.each do |operation| resource, id = parse_path(operation[:path]) attrs = { resource: resource, id: id, params: operation[:data] }.compact event_handler.dispatch(operation[:method], **attrs) end end |