Class: Cura::Event::Middleware::Dispatch

Inherits:
Base
  • Object
show all
Defined in:
lib/cura/event/middleware/dispatch.rb

Overview

Adds the event to the dispatch queue. Should be the very last middleware in the chain.

Instance Method Summary collapse

Instance Method Details

#call(options = {}) ⇒ Object

Add the event to the dispatch queue.

Parameters:

  • options (#to_h) (defaults to: {})

Options Hash (options):



11
12
13
14
15
16
17
18
# File 'lib/cura/event/middleware/dispatch.rb', line 11

def call(options={})
  # TODO: !!!! Refactor
  return nil if options[:event].nil?
  return nil if options[:event].target.nil?
  return nil if !options[:event].target.is_a?(Application) && options[:event].target.application.nil? # TODO: Check if orphaned, maybe log this?

  options[:dispatch_queue] << options[:event]
end