Sha256: 5c9cffdba02a92d4c757c5bc565a03418cc1006e6ea1ba42ba9f1249e47bdb67

Contents?: true

Size: 759 Bytes

Versions: 18

Compression:

Stored size: 759 Bytes

Contents

module Hyperloop
  class Operation
    class Railway

      def receivers
        self.class.receivers
      end

      class << self
        def receivers
          # use the force: true option so that system code needing to receive
          # boot will NOT be erased on the next Hyperloop::Context.reset!
          Hyperloop::Context.set_var(self, :@receivers, force: true) { [] }
        end

        def add_receiver(&block)
          receivers << block
        end
      end

      def dispatch
        result.then do
          receivers.each do |receiver|
            receiver.call(
              self.class.params_wrapper.dispatch_params(@operation.params),
              @operation
            )
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hyper-operation-0.99.6 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.99.5 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.99.4 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.99.3 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.99.2 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.99.1 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.99.0 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-1.0.0.lap28 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.12 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.11 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.10 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.9 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.8 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.7 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.6 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.5 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.4 lib/hyper-operation/railway/dispatcher.rb
hyper-operation-0.5.3 lib/hyper-operation/railway/dispatcher.rb