Sha256: 28678a5ac4b8a64ec5ef064b41b06a0a7a65357defa6804e824b748a1fd83282
Contents?: true
Size: 893 Bytes
Versions: 2
Compression:
Stored size: 893 Bytes
Contents
# frozen_string_literal: true module Emittance class Synchronous ## # The synchronous dispatcher. Runs callbacks one-by-one, in series. # class Dispatcher < Emittance::Dispatcher class << self private def _process_event(event) registrations_for(event).each do |registration| registration.call event end end def _register(identifier, _params = {}, &callback) registrations = registrations_for identifier registrations << callback callback end def _register_method_call(identifier, object, method_name, _params = {}) register identifier, &lambda_for_method_call(object, method_name) end def lambda_for_method_call(object, method_name) ->(event) { object.send method_name, event } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
emittance-1.1.0 | lib/emittance/dispatchers/synchronous.rb |
emittance-1.0.0 | lib/emittance/dispatchers/synchronous.rb |