Sha256: acd691c0647ac3a8d8abcb0ee5d0b98a468b80b47c7d72df8cd3bfd4ba00fc97
Contents?: true
Size: 865 Bytes
Versions: 4
Compression:
Stored size: 865 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, &callback) registrations = registrations_for identifier registrations << callback callback end def _register_method_call(identifier, object, method_name) 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
4 entries across 4 versions & 1 rubygems