Sha256: 11387562b762dd5ee74d3c1447f2d9ff5cfef85523056a3ed537fabb51d74141

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

module Hyperloop
  # insure at least a stub of operation is defined.  If
  # Hyperloop::Operation is already loaded it will have
  # defined these.
  class Operation
    class << self
      def on_dispatch(&block)
        receivers << block
      end

      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
    end
  end unless defined? Operation
  class Application
    class Boot < Operation
      class ReactDummyParams
        attr_reader :context
        def initialize(context)
          @context = context
        end
      end
      def self.run(context: nil)
        params = ReactDummyParams.new(context)
        receivers.each do |receiver|
          receiver.call params
        end
      end
    end unless defined? Boot
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyper-store-0.2.2 lib/hyperloop/application/boot.rb